AngularJS Example

by Stepan Suvorov

HTML

Controller Model: <input ng-model="title"> <br>
Passing through isolated scope:<zippy zippy-title="...{{title}}..."></zippy>

CSS

</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ --> 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>

JavaScript

function Ctrl3($scope) {
  $scope.title = 'xxx';
}

angular.module('zippyModule', [])
  .directive('zippy', function(){
    return {
      restrict: 'E',
      replace: true,
      scope: { title:'@zippyTitle' },
      template: '<input value="{{title}}">',
      link: function(scope, element, attrs) {}
    }
  });