【发布时间】:2015-10-09 19:25:49
【问题描述】:
所以我知道在指令中定义范围时,'@' 表示字符串,'=' 表示双向绑定。 “&”是什么意思?
这是一个示例指令:
angular.module('NoteWrangler')
.directive('nwCard', function() {
return {
restrict: 'E',
templateUrl: './templates/directives/nw-card.html',
scope: {
header: '@',
description: '=',
tweeted: '='
},
link: function(scope, element, attrs){
if(scope.tweeted)
element.addClass('tweeted');
}
};
});
【问题讨论】:
标签: angularjs angularjs-directive angularjs-scope