Advertisement
Guest User

main.js

a guest
Jan 31st, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var app = angular.module('myApp', ['ngRoute']);
  2.  
  3. app.config(['$routeProvider', '$locationProvider'], function ($routeProvider, $locationProvider) {
  4.  
  5.     $routeProvider.when('/route1', {
  6.         templateUrl: 'html/route1.html',
  7.         controller: 'route1Controller'
  8.     });
  9.    
  10.     $routeProvider.when('/route2', {
  11.         templateUrl: 'html/route2.html',
  12.         controller: 'route2Controller'
  13.     });
  14. });
  15.  
  16.  
  17. app.controller('route1Controller', function ($scope) {
  18.     $scope.message = "Index Controller is here :3";
  19. });
  20.  
  21.  
  22. app.controller('route2Controller', function($scope) {
  23.     $scope.message = "You've been switching to route 2 now :3"
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement