1
我是AngularJS的新手,我正在玩这个路线。但是UI路由器不会将我的URL“转换”为他正确的href属性。AngularJS UI路由器创建没有href
笔者认为:
<a ui-sref="music.detail({postID: post.id})" class="text-ellipsis">{{post.first_name}}</a>
这是从我的router.js
.state('music.detail', {
url: '/{postId}',
templateUrl: 'tpl/music.detail.html'
})
但HTML输出仍没有ID。 {{post.id}}
工作正常,并返回JSON对象的ID。
<a ui-sref="music.detail({postID: post.id})" class="text-ellipsis ng-binding" href="#/music/">Tremaine Stehr</a>
我在这里错过了什么吗?
是这个表达式合适吗? '/ {postId:[0-9] {1,4}}' – agconti
您的代码中存在拼写错误。你应该使用'postId'而不是'postID' – dhavalcengg
我将它改为'/ {postID}'。但是这属于href问题吗?我不明白为什么.. – bobbybackblech