Route Module Components

ngRoute
The ngRoute module provides routing and deeplinking services and directives for angular apps.

Module Components

PropertyTypeDescription
ngViewDirectivengView is a directive that complements the $route service by including the rendered template of the current route into the main layout (index.html) file. Every time the current route changes, the included view changes with it according to the configuration of the $route service.
$routeProviderProviderUsed for configuring routes.
$routeService$route is used for deep-linking URLs to controllers and views (HTML partials). It watches $location.url() and tries to map the path to an existing route definition.
$routeParamsServiceThe $routeParams service allows you to retrieve the current set of route parameters.
ng-templateDirectiveThe directive is used to create an html view using script tag. It contains "id" attribute which is used by $routeProvider to map a view with a controller.

ng-template
Example
Define a script block with type as ng-template within the main module.
snippet
<div ng-app = "mainApp">
...
<script type = "text/ng-template" id = "addStudent.htm">
<h2> Add Student </h2>
{{message}}
</script>
</div>
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +