angular ui router - AngularJS - I want to open a new page with user details -
i have view shows list of users, , want open user details page, when user clicks on link.
it loads "users.html" page, when click on href, url on browser changes, doesn't load template user detail, console doesn't have errors.
here ng-repeat code:
<div class="lista-dicas" ng-repeat="user in users | orderby:'-id'"> <div class="col-md-12 box-noticia"> <h3 class="titulo"><a ui-sref="app.users.id({id: user.id})">{{ user.id }}</a></h3> <p class="subtitulo">{{ user.name }}</p> <p class="tags">{{ user.tags }}</p> <hr> </div> </div> my router configs
angular.module('myapp_dicas').config(routeconfig); function routeconfig($stateprovider, $urlrouterprovider) { $stateprovider .state('app.users', { url: '/users', templateurl: '/www/app/users/users.html', controller: 'userscontroller' }) .state('app.users.id', { url: '/:id', templateurl: 'www/app/users/user-detail.html', controller: 'userdetailcontroller' });
try change
url: '/:id', to
url: '/users/details/:id', ok, cause didn't work, have app state? if not, try change state names to, example, users , details (just this, no dots). cause now, looks id state child of users , may cause problem. , url details: url: '/users/details/:id', cause looks natural.
Comments
Post a Comment