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="#/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>
posted @ 2016-11-23 02:00 Tclywork 阅读(...) 评论(...) 编辑 收藏