-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
47 lines (38 loc) · 1.3 KB
/
app.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
39
40
41
42
43
44
45
46
47
var angProject = angular.module('ang-project', ['ngRoute']);
(function(app) {
'use strict'
app.controller('MainController', function($scope, $route, $routeParams, $location) {
$scope.$route = $route;
$scope.$location = $location;
$scope.$routeParams = $routeParams;
});
app.controller('Page1Controller', function($scope, $routeParams) {
$scope.name = 'Page1Controller';
$scope.params = $routeParams;
});
app.controller('Page2Controller', function($scope, $routeParams) {
$scope.name = 'Page2Controller';
$scope.params = $routeParams;
});
app.config(function($routeProvider, $locationProvider) {
$routeProvider.when('/home', {
controller: 'Page1Controller',
templateUrl: 'page1.html'
});
$routeProvider.when('/page1', {
controller: 'Page1Controller',
templateUrl: 'page1.html'
});
$routeProvider.when('/page2', {
controller: 'Page2Controller',
templateUrl: 'page2.html'
});
$routeProvider.otherwise({
redirectTo: '/home'
});
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
});
})(angProject);