I have a simple app with two states. First displays list of items, second is a detailed view of the chosen item. I use a $stateParams as a filter to select specific item in the detailed view. I wonder if there is a better way?
http://plnkr.co/edit/wJeyApEWquqskQot5dS7?p=preview
.state('list', { url: "/list", templateUrl: "list.html", controller: "ListController as list" }) .state('details', { url: "/details:itemId", templateUrl: "details.html", controller: "ListController as list" }) .controller("ListController", function($stateParams){ this.items = [ { itemId: 1, name: "item1", color: "red", size: "big" }, ... ]; this.id = $stateParams; }) <h1>list</h1> <ul> <li ng-repeat="item in list.items"> <a ui-sref="details({itemId:item.itemId})">{{item.name}}</a> </li> </ul> <h1>details</h1> <ul ng-repeat="detail in list.items | filter: list.id"> <li >{{detail.name}}</li> <li >{{detail.color}}</li> <li >{{detail.size}}</li> </ul>