Skip to content

Instantly share code, notes, and snippets.

@taly2808
Last active August 29, 2015 14:07
Show Gist options
  • Save taly2808/83d19aa063bf87d4bac2 to your computer and use it in GitHub Desktop.
Save taly2808/83d19aa063bf87d4bac2 to your computer and use it in GitHub Desktop.
angular.module('spaApp', ['ngRoute'])
.config(['$routeProvider',
function($routeProvider) {
$routeProvider
.when('/home', {
templateUrl: 'pages/home.html',
controller: 'HomeController'
})
.when('/about', {
templateUrl: 'pages/about.html',
controller: 'AboutController'
})
.when('/contact', {
templateUrl: 'pages/contact.html',
controller: 'ContactController'
})
.otherwise({
redirectTo: '/home'
});
}
])
.controller('HomeController', function($scope) {
$scope.flash = 'Hello world! I am Tweedy bird.';
$scope.img = 'http://img2.wikia.nocookie.net/__cb20121120221843/scratchpad/images/thumb/5/54/Tweety.gif/180px-Tweety.gif';
})
.controller('AboutController', function($scope) {
$scope.flash = 'This is about page, hihi!';
})
.controller('ContactController', function($scope) {
$scope.flash = 'Contact with us at here!';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment