Dagm Fekadu
Dagm Fekadu

Reputation: 610

Can't get routeparams individually

retrieving the return is successful but can't seem to get the attributes individually

var myApp = angular.module('myApp', ['ngGrid', 'ngRoute', "ngAnimate", "ngAria", 'ngMaterial']);

myApp.config(['$routeProvider', function ($routeProvider)
{
    $routeProvider.
    when('/:energyId/:energyChain/:resourceId/:facilityId',
    {
        templateUrl: '/Content/resourceTemplate.html',
        controller: 'detailsController',
        resolve: {
            SomeData: function ($route) {
                return $route.current.params;
            }
        }

    }).
    otherwise({
        redirectTo: '/param1/param1/param1/param1'
    });
}]);

myApp.controller('detailsController', ['$scope', '$routeParams', function ($scope,SomeData, $routeParams) {

    //this doesnt work 
    $scope.statusLabel = SomeData.energyChain;
    //but this works   $scope.statusLabel = SomeData;

Upvotes: 0

Views: 166

Answers (1)

Parmod
Parmod

Reputation: 1243

 myApp.controller('detailsController', ['$scope','SomeData','$routeParams', function ($scope,SomeData, $routeParams) 

wrong sequence of dependency

Upvotes: 2

Related Questions