angular-ui-router
  • Introduction
  • Configuring State
  • Activating State
  • Named Views
  • Nested State
  • onEnter onExit
  • Passing Data
  • Resolve Property
  • State Params
  • State Service
  • State Events
  • Abstract State
Powered by GitBook
On this page

Was this helpful?

State Params

$stateProvider
    .state('schools', { 
            url: '/schools/:id'
    })
    .state('classrooms', {
        url: '/classrooms/{id}
    })
    .state('activities', {
        url: '/activities',
        params: {id: { value: 42 }}
    })

// from browser
http://localhost:8080/#/classrooms/3

// access from controller
angular.module("myApp")
    .controller('MainCtrl', function($routeParams){
        var id = $routeParams.id; // :id same as in state config url 
    })
PreviousResolve PropertyNextState Service

Last updated 5 years ago

Was this helpful?