-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangular6.js
More file actions
42 lines (34 loc) · 1.31 KB
/
Copy pathangular6.js
File metadata and controls
42 lines (34 loc) · 1.31 KB
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
// script.js
// create the module and name it scotchApp
// also include ngRoute for all our routing needs
var scotchApp = angular.module('scotchApp', ['ngRoute']);
// configure our routes
scotchApp.config(function($routeProvider) {
$routeProvider
// route for the home page
.when('/', {
templateUrl : 'home.html',
controller : 'mainController'
})
// route for the about page
.when('/about', {
templateUrl : 'about.html',
controller : 'aboutController'
})
// route for the contact page
.when('/contact', {
templateUrl : 'contact.html',
controller : 'contactController'
});
});
// create the controller and inject Angular's $scope
scotchApp.controller('mainController', function($scope) {
// create a message to display in our view
$scope.message = 'This is home page from home.html';
});
scotchApp.controller('aboutController', function($scope) {
$scope.message = 'This is about page from about.html';
});
scotchApp.controller('contactController', function($scope) {
$scope.message = 'This is contact page from contact.html';
});