24d55393d05a0656fba6dc4bd1279dfcf660613c
[src/app-framework-demo.git] / afm-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];
8           var v = decodeURIComponent(item.split("=")[1]); 
9           (k in qd) ? qd[k].push(v) : qd[k] = [v];
10       });
11       return qd;
12     }
13
14   angular.module('@@APPNAME@@', [ // Warning: Appname should fit with gulpfile.js & index.html
15     'ui.router',
16     'ngAnimate',
17
18     //foundation
19     'foundation',
20     'foundation.dynamicRouting',
21     'foundation.dynamicRouting.animations',
22     
23     // external components
24     'ui-notification',
25     
26     // Application Components
27     'AppConfig',
28     'JQueryEmu',
29     'DashboardModule',
30     'UploadFiles',
31     'LinkButton',
32     'TokenRefresh',
33     'RangeSlider',
34     'ModalNotification'
35   ])
36     .value ('urlquery', ParseQueryString())
37     .config(config)
38     .run(run)
39   ;
40
41   config.$inject = ['$urlRouterProvider', '$locationProvider'];
42   
43   function config($urlProvider, $locationProvider, AppConfig) {
44     $urlProvider.otherwise('/dashboard');
45
46     // https://docs.angularjs.org/error/$location/nobase
47     $locationProvider.html5Mode(true).hashPrefix('!');
48     
49   }
50
51   function run() {
52     FastClick.attach(document.body);
53   }
54   
55 // Fondation-app.template is not included correctly by gulp 
56 // Include here missing templates from foundation-apps/dist/js/foundation-apps-templates.js
57 angular.module('foundation').run(['$templateCache', function($templateCache) {
58   $templateCache.put('components/modal/modal.html',
59     '<div\n' +
60     '  class="modal-overlay"\n' +
61     '  ng-click="hideOverlay()">\n' +
62     '  <aside\n' +
63     '    class="modal"\n' +
64     '    ng-click="$event.stopPropagation();"\n' +
65     '    ng-transclude>\n' +
66     '  </aside>\n' +
67     '</div>\n' +
68     '');
69 }]);
70
71 console.log ("opa=@@APPNAME@@ Loaded");
72 })();