var sampleApp = angular.module('phonecatApp', ['ngRoute']);
  
sampleApp .config(['$routeProvider',
  function($routeProvider) {
    $routeProvider.
      when('/addOrder', {
        templateUrl: 'templates/add-order.html',
        controller: 'AddOrderController'
      }).
      when('/showOrders', {
        templateUrl: 'templates/show-orders.html',
        controller: 'ShowOrdersController'
      }).
      otherwise({
        redirectTo: '/addOrder'
      });
  }]);
<div class="container">
    <div class="row">
    <div class="col-md-3">
        <ul class="nav">
            <li><a href="#AddNewOrder"> Add New Order </a></li>
            <li><a href="#ShowOrders"> Show Order </a></li>
        </ul>
    </div>
    <div class="col-md-9">
        <div ng-view=""></div>
    </div>
    </div>
</div>when('/ShowOrder/:orderId', {
      templateUrl: 'templates/show_order.html',
      controller: 'ShowOrderController'
});
sampleApp.controller('ShowOrderController', function($scope, $routeParams) {
 
    $scope.order_id = $routeParams.orderId;
 
});when('/AddNewOrder', {
    templateUrl: 'templates/add_order.html',
    controller: 'CommonController',
    foodata: 'addorder'
}).sampleApp.controller('CommonController', function($scope, $route) {
    //access the foodata property using $route.current
    var foo = $route.current.foodata;
     
    alert(foo);
     
});var myApp = angular.module('clockApp', ['ui.router']);
myApp.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider
    .state('home', {
      url: "/home",
      templateUrl: "partials/home.html",
      views: {
        "sidebar": {
            template: "partial.sidebar",
            controller: "SidebarCtrl"
        },
        "navbar": {
            template: "partial.navbar",
            controller: "NavbarCtrl"
        },
      }
      controller: function($scope) {
        // Prepare values for the main content.
      }
    })
});<!-- home.html -->
<body>
    <ul class="nav navbar-nav navbar-right">
        <li ui-sref-active="active"><a ui-sref="clock">Clock</a></li>
        <li ui-sref-active="active"><a ui-sref="world-clock">World Clock</a></li>
        <li ui-sref-active="active"><a ui-sref="alarm-clock">Alarm Clock</a></li>
        <li ui-sref-active="active"><a ui-sref="countdown-timer">Countdown Timer</a></li>
    </ul>
    <div class="container" ui-view="main"></div>
</body>$stateProvider.state('clock', {
    url: '/clock',
    views: {
        main: {
            templateUrl: 'views/clock.html',
            controller: 'ClockCtrl'
        }
    }
});
$stateProvider.state('clock.type', {
    url: '/:type',
    views: {
        'sub': {
            templateUrl: function ($stateParams) {
                return '/views/clock/' + $stateParams.type + '.html';
            }
        }
    }
});<a href="#/clock/analog">Analog Clock</a>
<a ui-sref="clock.type({type:'analog'})">Analog Clock</a>
$state.go('clock.type', {type: 'analog'});$urlRouterProvider.when("/clock", "/clock/digital");<div class="container" ui-view="main"></div>http://yourwebsite.com/#!/some/page/http://yourwebsite.com/?_escaped_fragment_=/some/page/with/ajax/content 'use strict';
describe("E2E: Testing Routes", function () {
    beforeEach(function () {
        browser().navigateTo('/');
    });
    it('should jump to the /clock/digital path when / is accessed', function () {
        browser().navigateTo('#/');
        expect(browser().location().path()).toBe("/clock/digital");
    });
    it('should have a working /alarm-clock route', function () {
        browser().navigateTo('#/alarm-clock');
        expect(browser().location().path()).toBe("/alarm-clock");
    });
    it('should have a working /world-clock route', function () {
        browser().navigateTo('#/world-clock');
        expect(browser().location().path()).toBe("/world-clock");
    });
    it('should jump to the /clock/digital path when /invalid-url is accessed', function () {
        browser().navigateTo('#/invalid-url');
        expect(browser().location().path()).toBe("/clock/digital");
    });
});