我正在尝试将参数传递给angular.js ui-router中的状态,如下所示:
.state('details', {
url: '/details/:index',
templateUrl: 'views/details.html'
})
索引正在通过ng-repeat索引
传递 <div ng-repeat="program in programs">
<h2>{{program.name}}</h2>
<p>{{program.description || "No Description"}}</p>
<p><a ui-sref="details({index: $index})">View details »</a></p>
</div>
我的问题是如何在details.html中读取状态网址中传递的索引?
答案 0 :(得分:12)