Rumah > Soal Jawab > teks badan
这是我的代码,求教!
<input type="text" ng-model="theirUrl">
<p some-attr="{{theirUrl}}" my-text="Click me" my-directive>
</p>
angular.module("app",[]).directive('myDirective',function(){
return {
restrict:'AE',
scope:{
myUrl: '@someAttr',
myText:'@'
},
template:'<input type="text" ng-model="myUrl"/><br><a href="{{myUrl}}">{{myText}}</a>'
};
});