-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
47 lines (35 loc) · 787 Bytes
/
index.js
File metadata and controls
47 lines (35 loc) · 787 Bytes
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
'use strict';
var $$get = require('lodash/object/get');
var $$set = require('lodash/object/set');
angular.module('ng.config', [])
.provider('$config', ConfigProvider);
var service = new ConfigService();
// make service available outside fo angular
module.exports = service;
function ConfigProvider() {
var vm = this;
vm.$get = $get;
vm.set = service.$.set;
vm.get = service.$.get;
function $get() {
return service;
}
}
function ConfigService() {
var vm = this;
vm.$ = {};
vm.$.load = load;
vm.$.get = get;
vm.$.set = set;
function get(path, def) {
return $$get(vm, path, def);
}
function set(path, value) {
return $$set(vm, path, value);
}
function load(data) {
for (var key in data) {
vm[key] = data[key];
}
}
}