Skip to content

Instantly share code, notes, and snippets.

@SergeiGolos
Created November 26, 2012 00:01
Show Gist options
  • Save SergeiGolos/4145940 to your computer and use it in GitHub Desktop.
Save SergeiGolos/4145940 to your computer and use it in GitHub Desktop.
[AngularStudent] Routing? Part1 (controller.js)
angular.module('ngViewTest', [],
function($routeProvider, $locationProvider) {
$routeProvider.when('/About', {
templateUrl: 'about.html' ,
controller : BasicPageCntl });
$routeProvider.when('/Details/:detailId', {
templateUrl: 'detailTemplate.html',
controller : DetailPageCntl});
$routeProvider.when('/', {
templateUrl: 'home.html' });
//$locationProvider.html5Mode(true);
});
function MainCntl($scope, $location) {
$scope.links = [ "Details/1",
"Details/2",
"Details/3",
"About"];
}
function BasicPageCntl($scope) { }
function DetailPageCntl($scope, $routeParams) {
$scope.test = $routeParams["detailId"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment