When using ui-route, we want to pass the information with the url.
Example:
angular.module('categories.bookmarks', [ 'categories.bookmarks.create', 'categories.bookmarks.edit', 'eggly.models.categories', 'eggly.models.bookmarks' ]) .config(function ($stateProvider) { $stateProvider .state('eggly.categories.bookmarks', { url: 'categories/:category', views: { 'bookmarks@': { controller: 'BookmarksController', templateUrl: 'app/categories/bookmarks/bookmarks.tmpl.html' } } }) }) .controller('BookmarksController', function ($scope, $stateParams) { $scope.currentCategory = $stateParams.category; $scope.stateParams = $stateParams; }) ;
Using :category to pass the params in url. And we can get the params in Controller by using $stateParams.