search

Home  >  Q&A  >  body text

angular.js - AngularJS自定义指令,加入replace属性就出错,不能正常显示,求教啊

这是我的代码,求教!

  <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>'
    };

});

伊谢尔伦伊谢尔伦2744 days ago717

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-15 17:12:40

    @someAttr是啥,@myUrl?

    reply
    0
  • Cancelreply