javascript - Use Angular ui-router State in Page Template -


is possible use state defined in ui-router's $stateprovider in view?

for example state looks this:

$stateprovider   .state('peoplelist', {       template: '<people></people>',   }) 

and html this:

<div class="header">   <button ng-click="updatelist()"></button> </div>  <!-- peoplelist view go here-->  <div class="footer">...</div> 

i have in controller, want $state.go reload peoplelist state, instead of whole page.

vm.updatelist = function() {   $state.go($state.current, {}, { reload: 'peoplelist' }); } 

is @ possible in angular?

any appreciated. in advance!

you can make separate controller peoplelist state , mention in state defination as:

$stateprovider   .state('peoplelist', {       template: '<people></people>',       controller: 'peoplelistcontroller'   }) 

and in peoplelistcontroller can

$state.reload() 

to reload state

also, if want navigate state state, can use $state.go as:

$state.go('peoplelist') 

it load peoplelist controller per state defination.

you can pass params $state.go , them state defination.

you can access them using $stateparams in controller.