-
Notifications
You must be signed in to change notification settings - Fork 0
/
six.html
53 lines (47 loc) · 1.81 KB
/
six.html
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
48
49
50
51
52
53
<!doctype html>
<!--
Author: Xan Gutierrez
Date: 2015-07-28
-->
<html data-ng-app="myApp">
<head>
<title>Using AngularJS Routes</title>
<meta charset="utf-8" />
</head>
<body data-ng-controller="simpleController">
<div>
<div data-ng-view=""></div>
</div>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-route/angular-route.min.js"></script>
<script>
var app = angular.module('myApp', ['ngRoute']);
app.controller('simpleController', function ($scope) {
$scope.customers = [
{name: 'John Smith', city: 'Phoenix'},
{name: 'John Doe', city: 'New York'},
{name: 'Jane Doe', city: 'San Francisco'}
];
$scope.addCustomer = function () {
$scope.customers.push({
name: $scope.newCustomer.name,
city: $scope.newCustomer.city
});
};
});
app.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'pages/view1.html',
controller: 'simpleController'
})
.when('/view2',
{
templateUrl: 'pages/view2.html',
controller: 'simpleController'
})
.otherwise({redirectTo: '/'});
});
</script>
</body>
</html>