UNPKG

landers.angular

Version:

landers.angular

73 lines (72 loc) 2.47 kB
;angular.module('Landers.angular') .factory('Flat', function () { function Flat(J, scope){ var that = Flat; this.apply = function(){ // if ( scope && ('$$phase' in scope) && (!scope.$$phase)) { // angular_scope_apply(scope, 'Flat.apply'); // } angular_scope_apply(scope, 'Flat.apply'); return this; }; this.get = function(key, subkey) { return that.get(J, key, subkey); }; this.pull = function(key) { var ret = that.pull(J, key); this.apply(); return ret; }; this.set = function(key, value, subkey){ that.set(J, key, value, subkey); return this.apply(); }; this.setOnce = function(key, value, subkey){ var ret = that.setOnce(J, key, value, subkey); this.apply(); return ret; }; this.delete = function(key) { that.delete(J, key); return this.apply(); }; this.clear = function(){ that.clear(J); return this.apply(); }; this.extend = function(json, subkey){ that.extend(J, json, subkey); return this.apply(); }; this.cut = function(key, index) { that.cut(J, key, index); return this.apply(); }; this.copy = function(key, start, end) { that.copy(J, key, start, end); return this.apply(); }; this.shift = function(key) { that.shift(J, key); return this.apply(); }; this.unshift = function(key, value) { that.unshift(J, key, value); return this.apply(); }; this.push = function(key, value){ that.push(J, key, value); return this.apply(); }; this.pop = function(key) { that.pop(J, key); return this.apply(); }; } angular.extend(Flat, { make : function(J, scope) { return new Flat(J, scope); }, }, Landers.flat); return Flat; });