<div my-directive
my-url="http://google.com"
my-link-text="Click me to go to Google"></div>
angular.module('myApp', [])
.directive('myDirective', function() {
return {
restrict: 'A',
replace: true,
scope: {
myUrl: '@', //绑定策略
myLinkText: '@' //绑定策略
},
template: '<a href="{{myUrl}}">' +
'{{myLinkText}}</a>'
};
});
2871

被折叠的 条评论
为什么被折叠?



