From 16ebf5e81c47ac9c6d5a5c727e86e9863e4051a1 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 7 May 2015 16:28:56 +0200 Subject: Add frontend (is supposed to be an external repo) --- frontend/.gitignore | 3 +++ frontend/.jshintrc | 12 ++++++++++++ frontend/app.js | 29 +++++++++++++++++++++++++++++ frontend/index.html | 15 +++++++++++++++ frontend/package.json | 15 +++++++++++++++ frontend/test.html | 7 +++++++ 6 files changed, 81 insertions(+) create mode 100644 frontend/.gitignore create mode 100644 frontend/.jshintrc create mode 100644 frontend/app.js create mode 100644 frontend/index.html create mode 100644 frontend/package.json create mode 100644 frontend/test.html diff --git a/frontend/.gitignore b/frontend/.gitignore new file mode 100644 index 0000000..04260be --- /dev/null +++ b/frontend/.gitignore @@ -0,0 +1,3 @@ +node_modules/ + +.*.sw? diff --git a/frontend/.jshintrc b/frontend/.jshintrc new file mode 100644 index 0000000..f4b366d --- /dev/null +++ b/frontend/.jshintrc @@ -0,0 +1,12 @@ +{ + "globals": { + "angular": true, + "require": true + }, + "unused": "vars", + "strict": true, + "globalstrict": true, + "undef": true, + "browser": true, + "devel": true +} 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)); + }; +}); diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..6fe29c2 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..bfd15de --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,15 @@ +{ + "name": "frontend", + "version": "0.0.1", + "description": "AngularJS playground", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Peter Wu", + "license": "MIT", + "dependencies": { + "angular": "^1.3.15", + "angular-route": "^1.3.15" + } +} diff --git a/frontend/test.html b/frontend/test.html new file mode 100644 index 0000000..50d82cb --- /dev/null +++ b/frontend/test.html @@ -0,0 +1,7 @@ +This is only a test for {{test.who}}. + +
+ -- cgit v1.2.1