angular.module('docsTransclusionExample', [])
.controller('Controller', ['$scope', function($scope) {
$scope.name = 'Tobias';
}])
.directive('myDialog', function() {
return {
restrict: 'E',
transclude: true,
scope: {},
templateUrl: 'my-dialog.html',
link: function (scope, element) {
scope.name = 'Jeff';
}
};
});
这个在官网上的directive代码,link函数起到的什么作用,解释有点费解,然后其中有三个参数
scope:is an Angular scope object.
element: is the jqLite-wrapped element that this directive matches.
attrs: is a hash object with key-value pairs of normalized attribute names and their corresponding attribute values.
这个用法是怎样的,scope好像就是return中得scope属性。。
至尊宝的传说
相关分类