Created
August 1, 2014 21:55
-
-
Save DESIGNfromWITHIN/394337f66ddd28ba7de9 to your computer and use it in GitHub Desktop.
AnglarJS MODX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create the module and name it DESIGNfromWITHIN | |
var DESIGNfromWITHIN = angular.module('DESIGNfromWITHIN', ['ngRoute', 'ngAnimate', 'ngSanitize']) | |
.config(function($sceProvider) { | |
// Completely disable SCE. For demonstration purposes only! | |
// Do not use in new projects. | |
$sceProvider.enabled(false); | |
}); | |
// configure our routes | |
DESIGNfromWITHIN.config(function($locationProvider, $routeProvider) { | |
// use the HTML5 History API | |
$locationProvider | |
.html5Mode(true); | |
$routeProvider | |
// route for the home page | |
.when('/', { | |
templateUrl : 'assets/templates/gulp_h5bp/pages/home.html', | |
controller : 'mainController' | |
}) | |
// route for the test page | |
.when('/test.html', { | |
templateUrl : 'assets/templates/gulp_h5bp/pages/test.html', | |
controller : 'testController' | |
}) | |
// route for the post page | |
.when('/blog-webdesign-development/:[[*alias]]', { | |
templateUrl : 'assets/templates/gulp_h5bp/pages/post.html', | |
controller : 'postController' | |
}) | |
.otherwise({ | |
redirectTo: '/' | |
}); | |
}); | |
// create the controller and inject Angular's $scope | |
DESIGNfromWITHIN.controller('mainController', function($scope, $http) { | |
$http.get('[[~2]]') | |
.then(function(res){ | |
$scope.message = res.data; | |
$scope.test = 'YES'; | |
}); | |
}); | |
DESIGNfromWITHIN.controller('postController', function($scope, $http) { | |
$http.get('[[~2]]') | |
.then(function(res){ | |
$scope.message = res.data; | |
$scope.test = 'YES'; | |
}); | |
}); | |
DESIGNfromWITHIN.controller('testController', function($scope, $http) { | |
$http.get('http://designfromwithin.com/assets/templates/gulp_h5bp/package.json') | |
.then(function(res){ | |
$scope.message = res.data; | |
$scope.test = 'YES'; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment