首页 > 代码库 > angularjs 路由参数

angularjs 路由参数

.state(‘classrooms‘,{    url: ‘/classrooms/:id‘}).state(‘classrooms‘,{    url: ‘/classrooms/{id}‘}).state(‘activities‘,{    url: ‘/activities‘,    params: {        id: { value: 42}    }})

 

localhost:3000/#/classrooms/3

 

function ClassroomController($stateParams){    var classroomID = $stateParams.id;}


<tr ng-repeat="classroom in classrooms.allClassrooms">    <td><a href="http://www.mamicode.com/#/classrooms/{{classroom.id}}/details">{{classroom.name}}</a></td>    <td>{{classroom.school.name}}</td>    <td><a ui-sref="classroom_summary({id: classroom.id})">{{classroom.teacher}}</a></td></tr>

angularjs 路由参数