Skip to content

Instantly share code, notes, and snippets.

@DESIGNfromWITHIN
Created August 1, 2014 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DESIGNfromWITHIN/394337f66ddd28ba7de9 to your computer and use it in GitHub Desktop.
Save DESIGNfromWITHIN/394337f66ddd28ba7de9 to your computer and use it in GitHub Desktop.
AnglarJS MODX
// 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