1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-12 02:42:48 +00:00

got angular routing working - starting on html components

This commit is contained in:
2016-05-15 01:58:38 -05:00
parent d680c85c4a
commit 73fcbe6a5f
22 changed files with 778 additions and 42 deletions

49
public/js/app.js Normal file
View File

@@ -0,0 +1,49 @@
var app = angular.module('app', ['ngRoute']);
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
$routeProvider.
when('/', {
templateUrl: '/public/view/index.html',
controller: 'IndexController'
}).
when('/sensors', {
templateUrl: '/public/view/404.html',
controller: 'SensorsController'
}).
when('/post/:postName', {
templateUrl: '/public/view/post.html',
controller: 'PostController'
}).
when('/discord', {
redirect: 'https://discordapp.com/invite/0Z2tzxKECEj2BHwj'
}).
otherwise({
templateUrl: '/public/view/404.html'
});
}]);
app.controller('IndexController', function($scope) {
$scope.message = 'This is Add new order screen';
});
app.controller('SensorsController', function($scope) {
$scope.message = 'This is Show orders screen';
});
//handle each post page after individual posts are selected
app.controller('PostController', function($scope, $route, $routeParams) {
$scope.post = "/public/posts/" + $routeParams.postName + ".html";
});