扫码关注官方订阅号
Title
就是为什么我点击li的时候他不会跳转页面呢?地址栏是没错的啊?
学习是最好的投资!
盗用了文档的代码,你为何不这样做呢?
$stateProvider .state('contacts', { abstract: true, url: '/contacts', templateUrl: 'contacts.html', controller: function($scope){ $scope.contacts = [{ id:0, name: "Alice" }, { id:1, name: "Bob" }]; } }) .state('contacts.list', { url: '/list', templateUrl: 'contacts.list.html' }) .state('contacts.detail', { url: '/:id', templateUrl: 'contacts.detail.html', controller: function($scope, $stateParams){ $scope.person = $scope.contacts[$stateParams.id]; } }) <!-- contacts.html --> <h1>Contacts Page</h1> <p ui-view></p> <!-- contacts.list.html --> <ul> <li ng-repeat="person in contacts"> <a ng-href="#/contacts/{{person.id}}">{{person.name}}</a> </li> </ul> <!-- contacts.detail.html --> <h2>{{ person.name }}</h2>
你检查下是不是页面和controller里面的问题。既然地址能跳那证明路由没有问题。你看看请求里面是否有加载你配置的那个页面。
至少要在第二个state的url中加/, url:'/:id'
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
盗用了文档的代码,你为何不这样做呢?
你检查下是不是页面和controller里面的问题。既然地址能跳那证明路由没有问题。你看看请求里面是否有加载你配置的那个页面。
至少要在第二个state的url中加/, url:'/:id'