所以我知道在指令中定義範圍時,'@'表示字符串,'='表示雙向綁定。 '&'是什麼意思?AngularJS - 自定義指令範圍「&」do?
這裏將是一個例子指令:
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');
}
};
});
http://stackoverflow.com/questions/14908133/what-is-the-difference-between-vs-and-in-angularjs –