From 3d2fda7dd39e2363682f1fa353c951ab0d44ddfa Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Tue, 9 Feb 2016 18:40:49 +0100 Subject: Implemented URL query parsing for initial token /opa/?token=abcde --- afb-client/app/Frontend/app.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'afb-client/app/Frontend/app.js') diff --git a/afb-client/app/Frontend/app.js b/afb-client/app/Frontend/app.js index 72e8123..ed4d2ea 100644 --- a/afb-client/app/Frontend/app.js +++ b/afb-client/app/Frontend/app.js @@ -1,5 +1,13 @@ (function() { 'use strict'; + + function ParseQueryString () { + var qd = {}; + location.search.substr(1).split("&").forEach(function(item) { + var k = item.split("=")[0], v = decodeURIComponent(item.split("=")[1]); (k in qd) ? qd[k].push(v) : qd[k] = [v]; + }); + return qd; + } angular.module('@@APPNAME@@', [ // Warning: Appname should fit with gulpfile.js & index.html 'ui.router', @@ -24,14 +32,13 @@ 'RangeSlider', 'ModalNotification' ]) + .value ('urlquery', ParseQueryString()) .config(config) .run(run) ; config.$inject = ['$urlRouterProvider', '$locationProvider']; - console.log ("***location=" + window.location + " search" + window.search); - function config($urlProvider, $locationProvider, ConfigApp) { $urlProvider.otherwise('/home'); -- cgit 1.2.3-korg