angularjs - $state, $stateParams, getting undefined object -


i getting unexpected results both methods.

i have $state configed

    $stateprovider                 .state('status', {                   url: "/status/:payment",                   controller: 'questctrl',                   templateurl: "index.html"                 }); 

and on controller have:

    angular.module('quest').controller('questctrl',function($scope,$stateparams,$state){       console.log($stateparams.payment); // undefined       console.log($state); // object {params: object, current: object, $current: extend, transition: null}  } 

i used $stateparams in other projects , worked can't figure out going on here..

        ['$scope','$stateparams','$state', function($scope,  $http,          $stateparams, $state) 

the names of services don't match variables.

so $http $stateparams service, $stateparams $state service, , $state undefined.

my advice: stop using array notation, clutters code , frequent source of bugs. instead, use ng-annotate part of build procedure, it, correctly, you.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -