标签:restrict direct ict return false mpi var scl attr
.directive(‘expander‘, function() { /* expander() restrict: E,A,C,M(元素,属性,样式,注释) transclude:true替换 compile(编译)和link(连接) <expander class=‘expander‘ expander-title=‘title‘></expander>
*/ var scope ={title : ‘=expanderTitle‘}; var template = ‘<div><div class="title" ng-click="toggle()">{{title}}</div><div class="body" ng-show="showMe" ng-transclude></div></div>‘; var link = function(scope, element, attrs){ scope.showMe = false; scope.toggle = function toggle() { scope.showMe = !scope.showMe; } } return { restrict : ‘EA‘, replace : true, transclude : true, scope : scope, template : template, link : link // link : function(scope, element, attrs) {} } })
标签:restrict direct ict return false mpi var scl attr
原文地址:http://www.cnblogs.com/alan-alan/p/7345216.html