-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.1.js
38 lines (30 loc) · 927 Bytes
/
app.1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var angProject = angular.module('ang-project', ['ngRoute']);
(function(app) {
'use strict'
app.controller('MainController', ($scope) => {
$scope.name = "home"
});
app.controller('Page1Controller', function($scope) {
$scope.name = 'Page 1';
});
app.controller('Page2Controller', function($scope) {
$scope.name = 'Page 2';
});
app.config(function($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'page1.html',
controller: 'Page1Controller'
});
$routeProvider.when('/page1', {
templateUrl: 'page1.html',
controller: 'Page1Controller'
});
$routeProvider.when('/page2', {
templateUrl: 'page2.html',
controller: 'Page2Controller'
});
$routeProvider.otherwise({
redirectTo: '/'
});
});
})(angProject);