Implemented URL query parsing for initial token /opa/?token=abcde
[src/app-framework-demo.git] / afb-client / app / Frontend / app.js
1 (function() {
2   'use strict';
3   
4   function ParseQueryString () {
5       var qd = {};
6       location.search.substr(1).split("&").forEach(function(item) {
7           var k = item.split("=")[0], v = decodeURIComponent(item.split("=")[1]); (k in qd) ? qd[k].push(v) : qd[k] = [v];
8       });
9       return qd;
10   }
11
12   angular.module('@@APPNAME@@', [ // Warning: Appname should fit with gulpfile.js & index.html
13     'ui.router',
14     'ngAnimate',
15
16     //foundation
17     'foundation',
18     'foundation.dynamicRouting',
19     'foundation.dynamicRouting.animations',
20     
21     // external components
22     'ui-notification',
23     
24     // Application Components
25     'ConfigApp',
26     'JQueryEmu',
27     'HomeModule',
28     'SampleModule',
29     'UploadFiles',
30     'LinkButton',
31     'TokenRefresh',
32     'RangeSlider',
33     'ModalNotification'
34   ])
35     .value ('urlquery', ParseQueryString())
36     .config(config)
37     .run(run)
38   ;
39
40   config.$inject = ['$urlRouterProvider', '$locationProvider'];
41   
42   function config($urlProvider, $locationProvider, ConfigApp) {
43     $urlProvider.otherwise('/home');
44
45     // https://docs.angularjs.org/error/$location/nobase
46     $locationProvider.html5Mode(true).hashPrefix('!');
47     
48   }
49
50   function run() {
51     FastClick.attach(document.body);
52   }
53
54 console.log ("opa=@@APPNAME@@ Loaded");
55 })();