Route Templates in Angular
A starting point for using route templates on jsFiddle.
HTML
<script type="text/ng-template" id="home.html">
Home Page.
</script>
<script type="text/ng-template" id="about.html">
About Page.
</script>
<script type="text/ng-template" id="contact.html">
Contact Page.
</script>
<div ng-controller="MainCtrl">
<ul>
<li><a href="#/home">Home</a></li>
<li><a href="#/about">About Us</a></li>
<li><a href="#/contact">Contact Us</a></li>
</ul>
<div ng-view></div>
</div>
JavaScript
var app = angular.module( "myApp", [] );
app.config( function ( $routeProvider ) {
$routeProvider
.when( '/home', { templateUrl: 'home.html' } )
.when( '/about', { templateUrl: 'about.html' } )
.when( '/contact', { templateUrl: 'contact.html' } )
.otherwise( { redirectTo: '/this' } );
});
app.controller( 'MainCtrl', function ( $scope ) {
});