AngularJS Simple Router Example

AngularJS Simple Router Example

HTML

<script type="text/ng-template" id="embedded.home.html">
    <h1> Home </h1>
</script>

<script type="text/ng-template" id="embedded.about.html">
    <h1> About </h1>
</script>

<div> 
      <div id="navigation">  
      <a href="#/home">Home</a>
      <a href="#/about">About</a>
      </div>
    
    <div ng-view></div>
</div>

 <script type="text/javascript">var $zoho = $zoho || {}; $zoho.salesiq = $zoho.salesiq || { widgetcode: "c70224b8b35832f4d1d2201064f6ed68d63f065a612f86d878ca75434ae35c22", values: {}, ready: function () { } }; var d = document; s = d.createElement("script"); s.crossOrigin = "anonymous"; s.type = "text/javascript"; s.id = "zsiqscript"; s.defer = true; s.src = "https://salesiq.zoho.com/widget"; t = d.getElementsByTagName("script")[0]; t.parentNode.insertBefore(s, t); d.write("<div id='zsiqwidget'></div>");</script>

JavaScript

angular.module('FunnyAnt.Examples.Routing', []);

 angular.module('FunnyAnt.Examples.Routing')
.controller('HomeController', function ($scope) {


});

 angular.module('FunnyAnt.Examples.Routing')
 .controller('AboutController', function ($scope) {});

 angular.module('FunnyAnt.Examples.Routing')
.config(function ($routeProvider) {
    $routeProvider.
    when('/home', {
        templateUrl: 'embedded.home.html',
        controller: 'HomeController'
    }).
    when('/about', {
        templateUrl: 'embedded.about.html',
        controller: 'AboutController'
    }).
    otherwise({
        redirectTo: '/home'
    });
});