AngularJs Dependency on Route Module

Adding & Declaring a Dependency on Route Module

·         Added an Angular Route Module
·         Declaring a Dependency of Angular Route Module

Added an Angular Route Module

In the above example we have added an angular route module in head section and it must be added in the angular application i.e.

<script src=""></script>

Declaring a Dependency of Angular Route Module

In the above example, we have declared an angular dependency module on application route called ngRoute i.e.

var app = angular.module("routesApp", ['ngRoute']);

The ngView/ ng-View Directive

The ngView/ng-view is a directive and its use to allow us to setup the angular routes.
The ngView directive has the following features.

1.             All the View will update, when events ($routeChangeStart$routeChangeSuccess,$routeChangeError$routeUpdate) are fired.
2.             It provides the Link between controllers to scope when routes are specified.
3.             It provides the link between the new scopes to the new templates.

In the above example we used ngView/ng-view directive i.e.

<div ng-view></div>

Inside the HTML div, ng-view renders the HTML template of the current given route. When the given current route changed that HTML template will also change.

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