I want to implement routing based on condition which I am retrieving from 
WebApi Call, Here I implemented code but routing is not working.

var app = angular.module("DynamicRouting", ["ngRoute", "adminSetting"])
.config(["$routeProvider", "$adminSettingProvider", function 
($routeProvider, $adminSettingProvider) {

    var routing = $adminSettingProvider.RoutingConfig;
    routing.Permission().then(function (response) {
        if (response.IsRoutingOne) {
            $routeProvider
             .when("/RouteOne", {
                 templateUrl: "Pages/RouteOne.html",
                 controller: "RouteOneController"
             })
        }
        if (response.IsRoutingTwo) {
            $routeProvider
            .when("/RouteTwo", {
                templateUrl: "Pages/RouteTwo.html",
                controller: "RouteTwoController"
            })
        }
        if (response.IsRoutingThree) {
            $routeProvider
            .when("/RouteThree", {
                templateUrl: "Pages/RouteThree.html",
                controller: "RouteThreeController"
            })
        }
        if (response.IsRoutingFour) {
            $routeProvider
            .when("/RouteFour", {
                templateUrl: "Pages/RouteFour.html",
                controller: "RouteFourController"
            })
        }
    })

}])
.controller("RouteOneController", function ($scope) {
    $scope.RouteText = "First Route";
})
.controller("RouteTwoController", function ($scope) {
    $scope.RouteText = "Two Route";
})
.controller("RouteThreeController", function ($scope) {
    $scope.RouteText = "Three Route";
})
.controller("RouteFourController", function ($scope) {
    $scope.RouteText = "Four Route";
})
.run(["$rootScope", "$adminSetting", function ($rootScope, $adminSetting) {
    $rootScope.PageLoadingIsCompleted = true;
}]);
}())
angular.bootstrap(document, ["DynamicRouting"]);


I have created AdminSettingProvider and I injected service in my 
adminSettingProvider and I am calling my web api method.

Thanks
Imrankhan

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to