aboutsummaryrefslogtreecommitdiffstats
path: root/demo-ui/app/services/model.js
blob: c41794b15abc8b4a3b1f79aae33ac5534ea14ac1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//
// For data that must be shared accross controllers
//

(function(){
var model = function ($log, dbg) {

	var _shared = {
		availableUnis : [],
		currentEpl    : null
	};

	var getAvailableUnis = function () {
		return _shared.availableUnis;
	}

	var setAvailableUnis = function (availableUnis) {
		dbg.p("in model:setAvailableUnis");
		_shared.availableUnis = availableUnis;
		dbg.pj(_shared.availableUnis);
	}

	// var getCurrentEplId = function () {
	// 	// dbg.p("in model:getCurrentEplId, returning: "+_shared.currentEplId);
	// 	return _shared.currentEplId;
	// }

	// var setCurrentEplId = function (currentEplId) {
	// 	// dbg.p("in model:setCurrentEplId, setting to: "+currentEplId);
	// 	_shared.currentEplId = currentEplId;
	// }

	var getCurrentEpl = function () {
		dbg.p("in model:getCurrentEpl:");
		//dbg.pj(_shared.currentEpl);
		return _shared.currentEpl;
	}

	var setCurrentEpl = function (currentEpl) {
		// dbg.p("in model:setCurrentEplId, setting to: "+currentEplId);
		dbg.p("in model:setCurrentEpl");
		//dbg.pj(currentEpl);
		_shared.currentEpl = currentEpl;
	}


	var dumpShareDdata = function() { dbg.pj(_shared); };

	return { // Public API
			 getAvailableUnis : getAvailableUnis,
			 setAvailableUnis : setAvailableUnis,
			 getCurrentEpl    : getCurrentEpl,
			 setCurrentEpl    : setCurrentEpl,
			 dumpShareDdata   : dumpShareDdata
      };
   };

   var module = angular.module("vcpe");
   module.factory("model", model);

}());