Angular Route Parameters

The Angular Route Parameters :-
In the above example, we have declared three links with routes parameters with are given below.
In the above URLs, 1001, 1002 and 1003 are route parameters which are specified in the URLs and these parameters are added in the $routeProvider routes path i.e.
$routeProvider.when('/routeURL1/:params', {
                  templateUrl: 'templateURL1',
                  controller: 'routesController'
              when('/routeURL2/:params>', {
                  templateUrl: 'templateURL2',
                  controller: 'routesController'
              when('/routeURL3/:params', {
                  templateUrl: 'templateURL3',
                  controller: 'routesController'
                  redirectTo: '/login'
Now in the above routes, the when () function contain the parameters (: params) and the: params value will get from the $routeParams controller parameters. You can see the below code sample.
app.controller("routesController", function ($scope, $routeParams) {
     $scope.params = $routeParams.param;

About Blogger


Hey! I am Anil Singh. I am Active Blogger, Writer and Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...

    Blogger Comment
    Facebook Comment
SQL Server NodeJs TypeScript JavaScript Angular SQL Server My Book