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
Post a Comment