Skip to content

chrisbrooks/angularRouting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

angularRouting

About

This is simply a simple angular JS routing example demonstrating how you can using angular to route to different pages on a site. For simplicity purposes botstrap was used for the styling.

	// create the module and name it scotchApp
	var routingExample = angular.module('routingExample', ['ngRoute']);

	// configure our routes
	routingExample.config(function($routeProvider) {
		$routeProvider

			// route for the home page
			.when('/', {
				templateUrl : 'pages/home.html',
				controller  : 'mainController'
			})

			// route for the about page
			.when('/about', {
				templateUrl : 'pages/about.html',
				controller  : 'aboutController'
			})

			// route for the contact page
			.when('/contact', {
				templateUrl : 'pages/contact.html',
				controller  : 'contactController'
			});
	});

	// create the controller and inject Angular's $scope
	routingExample.controller('mainController', function($scope) {
		// create a message to display in our view
		$scope.message = 'This is the home page message';
	});

	routingExample.controller('aboutController', function($scope) {
		$scope.message = 'This is the about page message';
	});

	routingExample.controller('contactController', function($scope) {
		$scope.message = 'This is the contact page message';
	});

About

Simple angular JS routing example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published