使用 angularjs (+ionic) 我正在尝试这样做:
<ion-item menu-close ng-repeat="button in MenuButtons" {{button.type}}={{button.link}}>
我期望的结果是:
<ion-item menu-close ng-repeat="button in MenuButtons" href="mypage.html">
相反,我得到:
<ion-item menu-close="" ng-repeat="button in MenuButtons" {{button.type}}="{{button.link}}" class="item ng-binding" style="">
我的问题是 {{button.type}}={{button.link}}
也就是说,以下内容对我来说效果很好,链接是“mypage.html”:
href={{button.link}} --> href="mypage.html"
我错过了什么?
最佳答案
无法通过 {{}}
Angular 表达式绑定(bind)属性名称。
相反,请尝试使用 ng-href
:
<ion-item ng-href="{{pageName}}.html"></ion-item>
更多详细信息请参见Angular ng-href article
关于javascript - 生成 Angular JS href,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33380816/