summaryrefslogtreecommitdiff
path: root/frontend/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/app.js')
-rw-r--r--frontend/app.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/frontend/app.js b/frontend/app.js
new file mode 100644
index 0000000..1728048
--- /dev/null
+++ b/frontend/app.js
@@ -0,0 +1,29 @@
+'use strict';
+
+angular.module('someapp', ['ngRoute'])
+.config(function($routeProvider) {
+ // Sets route definition that will be used on route change when no other
+ // route definition is matched.
+ // https://docs.angularjs.org/api/ngRoute/provider/$routeProvider#otherwise
+ $routeProvider
+ .when('/test', {
+ templateUrl: 'test.html',
+ controller: 'testCtrl',
+ controllerAs: 'test'
+ })
+ .when('/test/:what', {
+ templateUrl: 'test.html',
+ controller: 'testCtrl',
+ controllerAs: 'test'
+ });
+ //.otherwise('/404');
+})
+.controller('testCtrl', function($routeParams, $location) {
+ var test = this;
+ test.who = $routeParams.what || 'a moron';
+
+ test.updateRoute = function() {
+ console.log(test.who);
+ $location.path('/test/' + (test.who));
+ };
+});