Skip to main content
added 94 characters in body
Source Link
hon2a
  • 7.3k
  • 5
  • 47
  • 60

If some of your params are not supposed to show up in the URL, you need to combine url and params:

.state('home', { url: '/:foo', params: { foo: 'default value of foo', bar: 'default value of bar' }, ... }) 

and then use $stateParams properly:

.controller('SomeController', ['$scope', '$stateParams', function ($scope, $stateParams) { // ... (use $stateParams) }]) 

(see documentation).


And, if you're still stuck, please take a look at this working codepen demo.

If some of your params are not supposed to show up in the URL, you need to combine url and params:

.state('home', { url: '/:foo', params: { foo: 'default value of foo', bar: 'default value of bar' }, ... }) 

and then use $stateParams properly:

.controller('SomeController', ['$scope', '$stateParams', function ($scope, $stateParams) { // ... (use $stateParams) }]) 

(see documentation).

If some of your params are not supposed to show up in the URL, you need to combine url and params:

.state('home', { url: '/:foo', params: { foo: 'default value of foo', bar: 'default value of bar' }, ... }) 

and then use $stateParams properly:

.controller('SomeController', ['$scope', '$stateParams', function ($scope, $stateParams) { // ... (use $stateParams) }]) 

(see documentation).


And, if you're still stuck, please take a look at this working codepen demo.

Source Link
hon2a
  • 7.3k
  • 5
  • 47
  • 60

If some of your params are not supposed to show up in the URL, you need to combine url and params:

.state('home', { url: '/:foo', params: { foo: 'default value of foo', bar: 'default value of bar' }, ... }) 

and then use $stateParams properly:

.controller('SomeController', ['$scope', '$stateParams', function ($scope, $stateParams) { // ... (use $stateParams) }]) 

(see documentation).