Heim  >  Fragen und Antworten  >  Hauptteil

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

});

伊谢尔伦伊谢尔伦2713 Tage vor697

Antworte allen(1)Ich werde antworten

  • PHP中文网

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

    @someAttr是啥,@myUrl?

    Antwort
    0
  • StornierenAntwort