angular.js ui-router将变量传递给state url

时间:2014-07-01 19:08:45

标签: angularjs angular-ui-router

我正在尝试将参数传递给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中读取状态网址中传递的索引?

1 个答案:

答案 0 :(得分:12)

相关问题