angularjs - Angular state with parametes -


i trying navigate state providing parameters it. here code:

state:

a = angular.module('app.panel', []); a.config( function ($stateprovider) {     $stateprovider         .state('body.new', {         url: 'new',         templateurl:function($stateparams){             return 'http://localhost/' + 'new.aspx?panel_id=' +  $stateparams.panel_id         },         controller: 'newcontroller'     }); }); 

i navigating state this:

var url = $state.href('body.new', { parameter: $scope.parameters }); $window.open(url, '_blank'); 

in state $stateparams undefined. if doing in wrong way correct way might be?

thanks help.

update 1. have modified code this:

url: 'new/:panel_id', params: {      parameter: null, }, 

but problem still getting $stateparams undefined.

just cutting code down little bit, needs altering this:

a.config( function ($stateprovider, $stateparams) {   $stateprovider ... 

it's complaining $stateparams because weren't stating dependency.

edit:

or, try this:

a.config( function ($stateprovider, $state) {   $stateprovider ... 

then access via $state.params.id


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -