AngularJs Routes, Route Module & ng-View Example

The combination example over all the topics likes,

//Adding & Declaring a Dependency on Route Module
//The ng-View Directive
//Configuring the $routeProvider
//Links to Routes
//Route Parameters

<!DOCTYPE html>
<html lang="en">

    <title>AngularJs Routes</title>
    <script src=""></script>
    <script src=""></script>
        var app = angular.module("routesApp", ['ngRoute']);

        app.controller("routesController", function ($scope, $routeParams) {
            $scope.params = $routeParams.param;

          function ($routeProvider) {
              $routeProvider.when('/routeURL1/:params', {
                  templateUrl: 'templateURL1',
                  controller: 'routesController'
              when('/routeURL2/:params>', {
                  templateUrl: 'templateURL2',
                  controller: 'routesController'
              when('/routeURL3/:params', {
                  templateUrl: 'templateURL3',
                  controller: 'routesController'
                  redirectTo: '/login'

<body ng-app="routesApp">
    <div ng-view></div>
                <a href="#/ruteoURL1/1001">Route Text1 with Params</a>
                <a href="#/routeURL2/1002">Route Text2 with Params</a>
                <a href="#/routeURL3/1003">Route Text3 with Params</a>

//The output as given below

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