angular-observe
Advanced tools
Comparing version 3.1.2 to 3.1.3
@@ -105,2 +105,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
tElement.empty(); | ||
return function postLink($scope, $element, $attrs) { | ||
@@ -112,4 +114,2 @@ var childScope; | ||
$element.empty(); | ||
$scope.$watch(sourceModel, function (source) { | ||
@@ -233,6 +233,6 @@ if (subscription) { | ||
switch (node.nodeName.toLowerCase()) { | ||
case 'loading': return stateTemplates.loading.push(node); | ||
case 'active': return stateTemplates.active.push(node); | ||
case 'error': return stateTemplates.error.push(node); | ||
case 'complete': return stateTemplates.complete.push(node); | ||
case 'loading': return stateTemplates.loading.push.apply(stateTemplates.loading, node.childNodes); | ||
case 'active': return stateTemplates.active.push.apply(stateTemplates.active, node.childNodes); | ||
case 'error': return stateTemplates.error.push.apply(stateTemplates.error, node.childNodes); | ||
case 'complete': return stateTemplates.complete.push.apply(stateTemplates.complete, node.childNodes); | ||
default: return template.push(node); | ||
@@ -259,6 +259,7 @@ } | ||
var clone = Angular.element(template).clone(); | ||
var active = Angular.element(template).clone(); | ||
var complete = Angular.element(template).clone(); | ||
stateLinkFunctions.active = $compile(clone); | ||
stateLinkFunctions.complete = $compile(clone.clone()); | ||
stateLinkFunctions.active = $compile(active); | ||
stateLinkFunctions.complete = $compile(complete); | ||
} | ||
@@ -265,0 +266,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("angular")):"function"==typeof define&&define.amd?define(["angular"],n):"object"==typeof exports?exports.AngularObserve=n(require("angular")):e.AngularObserve=n(e.angular)}(this,function(e){return function(e){function n(t){if(r[t])return r[t].exports;var o=r[t]={exports:{},id:t,loaded:!1};return e[t].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){e.exports=r(2)},function(n,r){n.exports=e},function(e,n,r){var t=r(1);e.exports="filearts.angularObserve";var o=t.module(e.exports,[]);o.provider("asyncBindConfig",[function(){this.fromValue=function(){throw new Error("You need to overwrite `asyncBindConfig.fromValue`.")},this.fromPromise=function(){throw new Error("You need to overwrite `asyncBindConfig.fromPromise`.")},this.map=function(){throw new Error("You need to overwrite `asyncBindConfig.map`.")},this.switchMap=function(){throw new Error("You need to overwrite `asyncBindConfig.switchMap`.")},this.$get=function(){return this}}]),o.directive("asyncBind",["$compile","$q","$rootScope","$timeout","asyncBindConfig",function(e,n,r,o,i){function u(e,n){var t=(n.asyncBind||n.source).split(/\s+as\s+/i),o=t.shift().split("."),u=t[0]||"$value",s=o.shift(),f=a(e,u);return function(e,n,t){function a(e){function n(e){var n=typeof e;return"boolean"===n||"number"===n||"string"===n}var r=!n(g[u])||!n(e);g[u]=e,d("active",r)}function p(e){d("complete")}function l(e){g.$error=e,d("error")}function d(e,r){if(r||e!==h){var t=f[e];if(m&&m.$destroy(),!t)return void n.empty();m=g.$new(),h=e,t(m,function(e){n.empty(),n.append(e)})}g.$root.$$phase||g.$digest(!0)}var m,h,v,g=r.$new(!0,e);n.empty(),e.$watch(s,function(e){function n(e){var n=e.shift(),t=e;return function(e){var o=e[n];return o?r(t,o):i.fromValue()}}function r(e,r){var t=c(r);return e.length?i.switchMap.call(t,n(e)):t}v&&(v.unsubscribe(),v=null),d("loading"),v=r(o,e).subscribe(a,l,p)}),e.$on("$destroy",function(){v&&(v.unsubscribe(),v=null)})}}function c(e){return e&&"function"==typeof e.subscribe?e:e&&"function"==typeof e.then?i.fromPromise(e):i.fromValue(e)}function a(n,r){var o={},i={loading:[],active:[],error:[],complete:[]},u=[];t.forEach(n.contents(),function(e){switch(e.nodeName.toLowerCase()){case"loading":return i.loading.push(e);case"active":return i.active.push(e);case"error":return i.error.push(e);case"complete":return i.complete.push(e);default:return u.push(e)}});var c=!1;if(t.forEach(i,function(n,r){if(n.length){c=!0;var i=t.element(n).clone();o[r]=e(i)}}),!c){u.length||u.push(document.createTextNode("{{"+r+"}}"));var a=t.element(u).clone();o.active=e(a),o.complete=e(a.clone())}return o}return{restrict:"EA",scope:!0,compile:u}}])}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("angular")):"function"==typeof define&&define.amd?define(["angular"],n):"object"==typeof exports?exports.AngularObserve=n(require("angular")):e.AngularObserve=n(e.angular)}(this,function(e){return function(e){function n(o){if(r[o])return r[o].exports;var t=r[o]={exports:{},id:o,loaded:!1};return e[o].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}var r={};return n.m=e,n.c=r,n.p="",n(0)}([function(e,n,r){e.exports=r(2)},function(n,r){n.exports=e},function(e,n,r){var o=r(1);e.exports="filearts.angularObserve";var t=o.module(e.exports,[]);t.provider("asyncBindConfig",[function(){this.fromValue=function(){throw new Error("You need to overwrite `asyncBindConfig.fromValue`.")},this.fromPromise=function(){throw new Error("You need to overwrite `asyncBindConfig.fromPromise`.")},this.map=function(){throw new Error("You need to overwrite `asyncBindConfig.map`.")},this.switchMap=function(){throw new Error("You need to overwrite `asyncBindConfig.switchMap`.")},this.$get=function(){return this}}]),t.directive("asyncBind",["$compile","$q","$rootScope","$timeout","asyncBindConfig",function(e,n,r,t,i){function u(e,n){var o=(n.asyncBind||n.source).split(/\s+as\s+/i),t=o.shift().split("."),u=o[0]||"$value",s=t.shift(),f=a(e,u);return e.empty(),function(e,n,o){function a(e){function n(e){var n=typeof e;return"boolean"===n||"number"===n||"string"===n}var r=!n(g[u])||!n(e);g[u]=e,d("active",r)}function l(e){d("complete")}function p(e){g.$error=e,d("error")}function d(e,r){if(r||e!==m){var o=f[e];if(h&&h.$destroy(),!o)return void n.empty();h=g.$new(),m=e,o(h,function(e){n.empty(),n.append(e)})}g.$root.$$phase||g.$digest(!0)}var h,m,v,g=r.$new(!0,e);e.$watch(s,function(e){function n(e){var n=e.shift(),o=e;return function(e){var t=e[n];return t?r(o,t):i.fromValue()}}function r(e,r){var o=c(r);return e.length?i.switchMap.call(o,n(e)):o}v&&(v.unsubscribe(),v=null),d("loading"),v=r(t,e).subscribe(a,p,l)}),e.$on("$destroy",function(){v&&(v.unsubscribe(),v=null)})}}function c(e){return e&&"function"==typeof e.subscribe?e:e&&"function"==typeof e.then?i.fromPromise(e):i.fromValue(e)}function a(n,r){var t={},i={loading:[],active:[],error:[],complete:[]},u=[];o.forEach(n.contents(),function(e){switch(e.nodeName.toLowerCase()){case"loading":return i.loading.push.apply(i.loading,e.childNodes);case"active":return i.active.push.apply(i.active,e.childNodes);case"error":return i.error.push.apply(i.error,e.childNodes);case"complete":return i.complete.push.apply(i.complete,e.childNodes);default:return u.push(e)}});var c=!1;if(o.forEach(i,function(n,r){if(n.length){c=!0;var i=o.element(n).clone();t[r]=e(i)}}),!c){u.length||u.push(document.createTextNode("{{"+r+"}}"));var a=o.element(u).clone(),s=o.element(u).clone();t.active=e(a),t.complete=e(s)}return t}return{restrict:"EA",scope:!0,compile:u}}])}])}); |
@@ -116,2 +116,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
tElement.empty(); | ||
return function postLink($scope, $element, $attrs) { | ||
@@ -123,4 +125,2 @@ var childScope; | ||
$element.empty(); | ||
$scope.$watch(sourceModel, function (source) { | ||
@@ -244,6 +244,6 @@ if (subscription) { | ||
switch (node.nodeName.toLowerCase()) { | ||
case 'loading': return stateTemplates.loading.push(node); | ||
case 'active': return stateTemplates.active.push(node); | ||
case 'error': return stateTemplates.error.push(node); | ||
case 'complete': return stateTemplates.complete.push(node); | ||
case 'loading': return stateTemplates.loading.push.apply(stateTemplates.loading, node.childNodes); | ||
case 'active': return stateTemplates.active.push.apply(stateTemplates.active, node.childNodes); | ||
case 'error': return stateTemplates.error.push.apply(stateTemplates.error, node.childNodes); | ||
case 'complete': return stateTemplates.complete.push.apply(stateTemplates.complete, node.childNodes); | ||
default: return template.push(node); | ||
@@ -270,6 +270,7 @@ } | ||
var clone = Angular.element(template).clone(); | ||
var active = Angular.element(template).clone(); | ||
var complete = Angular.element(template).clone(); | ||
stateLinkFunctions.active = $compile(clone); | ||
stateLinkFunctions.complete = $compile(clone.clone()); | ||
stateLinkFunctions.active = $compile(active); | ||
stateLinkFunctions.complete = $compile(complete); | ||
} | ||
@@ -276,0 +277,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("angular"),require("most")):"function"==typeof define&&define.amd?define(["angular","most"],r):"object"==typeof exports?exports.AngularObserve=r(require("angular"),require("most")):e.AngularObserve=r(e.angular,e.most)}(this,function(e,r){return function(e){function r(o){if(n[o])return n[o].exports;var t=n[o]={exports:{},id:o,loaded:!1};return e[o].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}var n={};return r.m=e,r.c=n,r.p="",r(0)}([function(e,r,n){var o=n(1),t=n(3);e.exports=n(2),o.module(e.exports).config(["asyncBindConfigProvider",function(e){e.fromPromise=t.fromPromise,e.fromValue=t.of,e.map=t.map,e.switchMap=t.switchLatest}])},function(r,n){r.exports=e},function(e,r,n){var o=n(1);e.exports="filearts.angularObserve";var t=o.module(e.exports,[]);t.provider("asyncBindConfig",[function(){this.fromValue=function(){throw new Error("You need to overwrite `asyncBindConfig.fromValue`.")},this.fromPromise=function(){throw new Error("You need to overwrite `asyncBindConfig.fromPromise`.")},this.map=function(){throw new Error("You need to overwrite `asyncBindConfig.map`.")},this.switchMap=function(){throw new Error("You need to overwrite `asyncBindConfig.switchMap`.")},this.$get=function(){return this}}]),t.directive("asyncBind",["$compile","$q","$rootScope","$timeout","asyncBindConfig",function(e,r,n,t,i){function u(e,r){var o=(r.asyncBind||r.source).split(/\s+as\s+/i),t=o.shift().split("."),u=o[0]||"$value",a=t.shift(),f=s(e,u);return function(e,r,o){function s(e){function r(e){var r=typeof e;return"boolean"===r||"number"===r||"string"===r}var n=!r(g[u])||!r(e);g[u]=e,m("active",n)}function p(e){m("complete")}function l(e){g.$error=e,m("error")}function m(e,n){if(n||e!==h){var o=f[e];if(d&&d.$destroy(),!o)return void r.empty();d=g.$new(),h=e,o(d,function(e){r.empty(),r.append(e)})}g.$root.$$phase||g.$digest(!0)}var d,h,v,g=n.$new(!0,e);r.empty(),e.$watch(a,function(e){function r(e){var r=e.shift(),o=e;return function(e){var t=e[r];return t?n(o,t):i.fromValue()}}function n(e,n){var o=c(n);return e.length?i.switchMap.call(o,r(e)):o}v&&(v.unsubscribe(),v=null),m("loading"),v=n(t,e).subscribe(s,l,p)}),e.$on("$destroy",function(){v&&(v.unsubscribe(),v=null)})}}function c(e){return e&&"function"==typeof e.subscribe?e:e&&"function"==typeof e.then?i.fromPromise(e):i.fromValue(e)}function s(r,n){var t={},i={loading:[],active:[],error:[],complete:[]},u=[];o.forEach(r.contents(),function(e){switch(e.nodeName.toLowerCase()){case"loading":return i.loading.push(e);case"active":return i.active.push(e);case"error":return i.error.push(e);case"complete":return i.complete.push(e);default:return u.push(e)}});var c=!1;if(o.forEach(i,function(r,n){if(r.length){c=!0;var i=o.element(r).clone();t[n]=e(i)}}),!c){u.length||u.push(document.createTextNode("{{"+n+"}}"));var s=o.element(u).clone();t.active=e(s),t.complete=e(s.clone())}return t}return{restrict:"EA",scope:!0,compile:u}}])},function(e,n){e.exports=r}])}); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("angular"),require("most")):"function"==typeof define&&define.amd?define(["angular","most"],r):"object"==typeof exports?exports.AngularObserve=r(require("angular"),require("most")):e.AngularObserve=r(e.angular,e.most)}(this,function(e,r){return function(e){function r(o){if(n[o])return n[o].exports;var t=n[o]={exports:{},id:o,loaded:!1};return e[o].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}var n={};return r.m=e,r.c=n,r.p="",r(0)}([function(e,r,n){var o=n(1),t=n(3);e.exports=n(2),o.module(e.exports).config(["asyncBindConfigProvider",function(e){e.fromPromise=t.fromPromise,e.fromValue=t.of,e.map=t.map,e.switchMap=t.switchLatest}])},function(r,n){r.exports=e},function(e,r,n){var o=n(1);e.exports="filearts.angularObserve";var t=o.module(e.exports,[]);t.provider("asyncBindConfig",[function(){this.fromValue=function(){throw new Error("You need to overwrite `asyncBindConfig.fromValue`.")},this.fromPromise=function(){throw new Error("You need to overwrite `asyncBindConfig.fromPromise`.")},this.map=function(){throw new Error("You need to overwrite `asyncBindConfig.map`.")},this.switchMap=function(){throw new Error("You need to overwrite `asyncBindConfig.switchMap`.")},this.$get=function(){return this}}]),t.directive("asyncBind",["$compile","$q","$rootScope","$timeout","asyncBindConfig",function(e,r,n,t,i){function u(e,r){var o=(r.asyncBind||r.source).split(/\s+as\s+/i),t=o.shift().split("."),u=o[0]||"$value",a=t.shift(),f=s(e,u);return e.empty(),function(e,r,o){function s(e){function r(e){var r=typeof e;return"boolean"===r||"number"===r||"string"===r}var n=!r(g[u])||!r(e);g[u]=e,d("active",n)}function p(e){d("complete")}function l(e){g.$error=e,d("error")}function d(e,n){if(n||e!==h){var o=f[e];if(m&&m.$destroy(),!o)return void r.empty();m=g.$new(),h=e,o(m,function(e){r.empty(),r.append(e)})}g.$root.$$phase||g.$digest(!0)}var m,h,v,g=n.$new(!0,e);e.$watch(a,function(e){function r(e){var r=e.shift(),o=e;return function(e){var t=e[r];return t?n(o,t):i.fromValue()}}function n(e,n){var o=c(n);return e.length?i.switchMap.call(o,r(e)):o}v&&(v.unsubscribe(),v=null),d("loading"),v=n(t,e).subscribe(s,l,p)}),e.$on("$destroy",function(){v&&(v.unsubscribe(),v=null)})}}function c(e){return e&&"function"==typeof e.subscribe?e:e&&"function"==typeof e.then?i.fromPromise(e):i.fromValue(e)}function s(r,n){var t={},i={loading:[],active:[],error:[],complete:[]},u=[];o.forEach(r.contents(),function(e){switch(e.nodeName.toLowerCase()){case"loading":return i.loading.push.apply(i.loading,e.childNodes);case"active":return i.active.push.apply(i.active,e.childNodes);case"error":return i.error.push.apply(i.error,e.childNodes);case"complete":return i.complete.push.apply(i.complete,e.childNodes);default:return u.push(e)}});var c=!1;if(o.forEach(i,function(r,n){if(r.length){c=!0;var i=o.element(r).clone();t[n]=e(i)}}),!c){u.length||u.push(document.createTextNode("{{"+n+"}}"));var s=o.element(u).clone(),a=o.element(u).clone();t.active=e(s),t.complete=e(a)}return t}return{restrict:"EA",scope:!0,compile:u}}])},function(e,n){e.exports=r}])}); |
@@ -116,2 +116,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
tElement.empty(); | ||
return function postLink($scope, $element, $attrs) { | ||
@@ -123,4 +125,2 @@ var childScope; | ||
$element.empty(); | ||
$scope.$watch(sourceModel, function (source) { | ||
@@ -244,6 +244,6 @@ if (subscription) { | ||
switch (node.nodeName.toLowerCase()) { | ||
case 'loading': return stateTemplates.loading.push(node); | ||
case 'active': return stateTemplates.active.push(node); | ||
case 'error': return stateTemplates.error.push(node); | ||
case 'complete': return stateTemplates.complete.push(node); | ||
case 'loading': return stateTemplates.loading.push.apply(stateTemplates.loading, node.childNodes); | ||
case 'active': return stateTemplates.active.push.apply(stateTemplates.active, node.childNodes); | ||
case 'error': return stateTemplates.error.push.apply(stateTemplates.error, node.childNodes); | ||
case 'complete': return stateTemplates.complete.push.apply(stateTemplates.complete, node.childNodes); | ||
default: return template.push(node); | ||
@@ -270,6 +270,7 @@ } | ||
var clone = Angular.element(template).clone(); | ||
var active = Angular.element(template).clone(); | ||
var complete = Angular.element(template).clone(); | ||
stateLinkFunctions.active = $compile(clone); | ||
stateLinkFunctions.complete = $compile(clone.clone()); | ||
stateLinkFunctions.active = $compile(active); | ||
stateLinkFunctions.complete = $compile(complete); | ||
} | ||
@@ -276,0 +277,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("angular"),require("rx")):"function"==typeof define&&define.amd?define(["angular","rx"],r):"object"==typeof exports?exports.AngularObserve=r(require("angular"),require("rx")):e.AngularObserve=r(e.angular,e.Rx)}(this,function(e,r){return function(e){function r(o){if(n[o])return n[o].exports;var t=n[o]={exports:{},id:o,loaded:!1};return e[o].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}var n={};return r.m=e,r.c=n,r.p="",r(0)}([function(e,r,n){var o=n(1),t=n(3);e.exports=n(2),o.module(e.exports).config(["asyncBindConfigProvider",function(e){e.fromPromise=t.Observable.fromPromise,e.fromValue=t.Observable.of,e.map=t.Observable.prototype.map,e.switchMap=t.Observable.prototype.flatMapLatest}])},function(r,n){r.exports=e},function(e,r,n){var o=n(1);e.exports="filearts.angularObserve";var t=o.module(e.exports,[]);t.provider("asyncBindConfig",[function(){this.fromValue=function(){throw new Error("You need to overwrite `asyncBindConfig.fromValue`.")},this.fromPromise=function(){throw new Error("You need to overwrite `asyncBindConfig.fromPromise`.")},this.map=function(){throw new Error("You need to overwrite `asyncBindConfig.map`.")},this.switchMap=function(){throw new Error("You need to overwrite `asyncBindConfig.switchMap`.")},this.$get=function(){return this}}]),t.directive("asyncBind",["$compile","$q","$rootScope","$timeout","asyncBindConfig",function(e,r,n,t,i){function u(e,r){var o=(r.asyncBind||r.source).split(/\s+as\s+/i),t=o.shift().split("."),u=o[0]||"$value",s=t.shift(),f=a(e,u);return function(e,r,o){function a(e){function r(e){var r=typeof e;return"boolean"===r||"number"===r||"string"===r}var n=!r(g[u])||!r(e);g[u]=e,d("active",n)}function p(e){d("complete")}function l(e){g.$error=e,d("error")}function d(e,n){if(n||e!==v){var o=f[e];if(m&&m.$destroy(),!o)return void r.empty();m=g.$new(),v=e,o(m,function(e){r.empty(),r.append(e)})}g.$root.$$phase||g.$digest(!0)}var m,v,h,g=n.$new(!0,e);r.empty(),e.$watch(s,function(e){function r(e){var r=e.shift(),o=e;return function(e){var t=e[r];return t?n(o,t):i.fromValue()}}function n(e,n){var o=c(n);return e.length?i.switchMap.call(o,r(e)):o}h&&(h.unsubscribe(),h=null),d("loading"),h=n(t,e).subscribe(a,l,p)}),e.$on("$destroy",function(){h&&(h.unsubscribe(),h=null)})}}function c(e){return e&&"function"==typeof e.subscribe?e:e&&"function"==typeof e.then?i.fromPromise(e):i.fromValue(e)}function a(r,n){var t={},i={loading:[],active:[],error:[],complete:[]},u=[];o.forEach(r.contents(),function(e){switch(e.nodeName.toLowerCase()){case"loading":return i.loading.push(e);case"active":return i.active.push(e);case"error":return i.error.push(e);case"complete":return i.complete.push(e);default:return u.push(e)}});var c=!1;if(o.forEach(i,function(r,n){if(r.length){c=!0;var i=o.element(r).clone();t[n]=e(i)}}),!c){u.length||u.push(document.createTextNode("{{"+n+"}}"));var a=o.element(u).clone();t.active=e(a),t.complete=e(a.clone())}return t}return{restrict:"EA",scope:!0,compile:u}}])},function(e,n){e.exports=r}])}); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("angular"),require("rx")):"function"==typeof define&&define.amd?define(["angular","rx"],r):"object"==typeof exports?exports.AngularObserve=r(require("angular"),require("rx")):e.AngularObserve=r(e.angular,e.Rx)}(this,function(e,r){return function(e){function r(o){if(n[o])return n[o].exports;var t=n[o]={exports:{},id:o,loaded:!1};return e[o].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}var n={};return r.m=e,r.c=n,r.p="",r(0)}([function(e,r,n){var o=n(1),t=n(3);e.exports=n(2),o.module(e.exports).config(["asyncBindConfigProvider",function(e){e.fromPromise=t.Observable.fromPromise,e.fromValue=t.Observable.of,e.map=t.Observable.prototype.map,e.switchMap=t.Observable.prototype.flatMapLatest}])},function(r,n){r.exports=e},function(e,r,n){var o=n(1);e.exports="filearts.angularObserve";var t=o.module(e.exports,[]);t.provider("asyncBindConfig",[function(){this.fromValue=function(){throw new Error("You need to overwrite `asyncBindConfig.fromValue`.")},this.fromPromise=function(){throw new Error("You need to overwrite `asyncBindConfig.fromPromise`.")},this.map=function(){throw new Error("You need to overwrite `asyncBindConfig.map`.")},this.switchMap=function(){throw new Error("You need to overwrite `asyncBindConfig.switchMap`.")},this.$get=function(){return this}}]),t.directive("asyncBind",["$compile","$q","$rootScope","$timeout","asyncBindConfig",function(e,r,n,t,i){function u(e,r){var o=(r.asyncBind||r.source).split(/\s+as\s+/i),t=o.shift().split("."),u=o[0]||"$value",s=t.shift(),f=a(e,u);return e.empty(),function(e,r,o){function a(e){function r(e){var r=typeof e;return"boolean"===r||"number"===r||"string"===r}var n=!r(y[u])||!r(e);y[u]=e,d("active",n)}function p(e){d("complete")}function l(e){y.$error=e,d("error")}function d(e,n){if(n||e!==v){var o=f[e];if(m&&m.$destroy(),!o)return void r.empty();m=y.$new(),v=e,o(m,function(e){r.empty(),r.append(e)})}y.$root.$$phase||y.$digest(!0)}var m,v,h,y=n.$new(!0,e);e.$watch(s,function(e){function r(e){var r=e.shift(),o=e;return function(e){var t=e[r];return t?n(o,t):i.fromValue()}}function n(e,n){var o=c(n);return e.length?i.switchMap.call(o,r(e)):o}h&&(h.unsubscribe(),h=null),d("loading"),h=n(t,e).subscribe(a,l,p)}),e.$on("$destroy",function(){h&&(h.unsubscribe(),h=null)})}}function c(e){return e&&"function"==typeof e.subscribe?e:e&&"function"==typeof e.then?i.fromPromise(e):i.fromValue(e)}function a(r,n){var t={},i={loading:[],active:[],error:[],complete:[]},u=[];o.forEach(r.contents(),function(e){switch(e.nodeName.toLowerCase()){case"loading":return i.loading.push.apply(i.loading,e.childNodes);case"active":return i.active.push.apply(i.active,e.childNodes);case"error":return i.error.push.apply(i.error,e.childNodes);case"complete":return i.complete.push.apply(i.complete,e.childNodes);default:return u.push(e)}});var c=!1;if(o.forEach(i,function(r,n){if(r.length){c=!0;var i=o.element(r).clone();t[n]=e(i)}}),!c){u.length||u.push(document.createTextNode("{{"+n+"}}"));var a=o.element(u).clone(),s=o.element(u).clone();t.active=e(a),t.complete=e(s)}return t}return{restrict:"EA",scope:!0,compile:u}}])},function(e,n){e.exports=r}])}); |
@@ -116,2 +116,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
tElement.empty(); | ||
return function postLink($scope, $element, $attrs) { | ||
@@ -123,4 +125,2 @@ var childScope; | ||
$element.empty(); | ||
$scope.$watch(sourceModel, function (source) { | ||
@@ -244,6 +244,6 @@ if (subscription) { | ||
switch (node.nodeName.toLowerCase()) { | ||
case 'loading': return stateTemplates.loading.push(node); | ||
case 'active': return stateTemplates.active.push(node); | ||
case 'error': return stateTemplates.error.push(node); | ||
case 'complete': return stateTemplates.complete.push(node); | ||
case 'loading': return stateTemplates.loading.push.apply(stateTemplates.loading, node.childNodes); | ||
case 'active': return stateTemplates.active.push.apply(stateTemplates.active, node.childNodes); | ||
case 'error': return stateTemplates.error.push.apply(stateTemplates.error, node.childNodes); | ||
case 'complete': return stateTemplates.complete.push.apply(stateTemplates.complete, node.childNodes); | ||
default: return template.push(node); | ||
@@ -270,6 +270,7 @@ } | ||
var clone = Angular.element(template).clone(); | ||
var active = Angular.element(template).clone(); | ||
var complete = Angular.element(template).clone(); | ||
stateLinkFunctions.active = $compile(clone); | ||
stateLinkFunctions.complete = $compile(clone.clone()); | ||
stateLinkFunctions.active = $compile(active); | ||
stateLinkFunctions.complete = $compile(complete); | ||
} | ||
@@ -276,0 +277,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("angular"),require("rxjs")):"function"==typeof define&&define.amd?define(["angular","rxjs"],r):"object"==typeof exports?exports.AngularObserve=r(require("angular"),require("rxjs")):e.AngularObserve=r(e.angular,e.rxjs)}(this,function(e,r){return function(e){function r(o){if(n[o])return n[o].exports;var t=n[o]={exports:{},id:o,loaded:!1};return e[o].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}var n={};return r.m=e,r.c=n,r.p="",r(0)}([function(e,r,n){var o=n(1),t=n(3);e.exports=n(2),o.module(e.exports).config(["asyncBindConfigProvider",function(e){e.fromPromise=t.Observable.fromPromise,e.fromValue=t.Observable.of,e.map=t.Observable.prototype.map,e.switchMap=t.Observable.prototype.switchMap}])},function(r,n){r.exports=e},function(e,r,n){var o=n(1);e.exports="filearts.angularObserve";var t=o.module(e.exports,[]);t.provider("asyncBindConfig",[function(){this.fromValue=function(){throw new Error("You need to overwrite `asyncBindConfig.fromValue`.")},this.fromPromise=function(){throw new Error("You need to overwrite `asyncBindConfig.fromPromise`.")},this.map=function(){throw new Error("You need to overwrite `asyncBindConfig.map`.")},this.switchMap=function(){throw new Error("You need to overwrite `asyncBindConfig.switchMap`.")},this.$get=function(){return this}}]),t.directive("asyncBind",["$compile","$q","$rootScope","$timeout","asyncBindConfig",function(e,r,n,t,i){function u(e,r){var o=(r.asyncBind||r.source).split(/\s+as\s+/i),t=o.shift().split("."),u=o[0]||"$value",a=t.shift(),f=s(e,u);return function(e,r,o){function s(e){function r(e){var r=typeof e;return"boolean"===r||"number"===r||"string"===r}var n=!r(g[u])||!r(e);g[u]=e,d("active",n)}function p(e){d("complete")}function l(e){g.$error=e,d("error")}function d(e,n){if(n||e!==v){var o=f[e];if(m&&m.$destroy(),!o)return void r.empty();m=g.$new(),v=e,o(m,function(e){r.empty(),r.append(e)})}g.$root.$$phase||g.$digest(!0)}var m,v,h,g=n.$new(!0,e);r.empty(),e.$watch(a,function(e){function r(e){var r=e.shift(),o=e;return function(e){var t=e[r];return t?n(o,t):i.fromValue()}}function n(e,n){var o=c(n);return e.length?i.switchMap.call(o,r(e)):o}h&&(h.unsubscribe(),h=null),d("loading"),h=n(t,e).subscribe(s,l,p)}),e.$on("$destroy",function(){h&&(h.unsubscribe(),h=null)})}}function c(e){return e&&"function"==typeof e.subscribe?e:e&&"function"==typeof e.then?i.fromPromise(e):i.fromValue(e)}function s(r,n){var t={},i={loading:[],active:[],error:[],complete:[]},u=[];o.forEach(r.contents(),function(e){switch(e.nodeName.toLowerCase()){case"loading":return i.loading.push(e);case"active":return i.active.push(e);case"error":return i.error.push(e);case"complete":return i.complete.push(e);default:return u.push(e)}});var c=!1;if(o.forEach(i,function(r,n){if(r.length){c=!0;var i=o.element(r).clone();t[n]=e(i)}}),!c){u.length||u.push(document.createTextNode("{{"+n+"}}"));var s=o.element(u).clone();t.active=e(s),t.complete=e(s.clone())}return t}return{restrict:"EA",scope:!0,compile:u}}])},function(e,n){e.exports=r}])}); | ||
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("angular"),require("rxjs")):"function"==typeof define&&define.amd?define(["angular","rxjs"],r):"object"==typeof exports?exports.AngularObserve=r(require("angular"),require("rxjs")):e.AngularObserve=r(e.angular,e.rxjs)}(this,function(e,r){return function(e){function r(o){if(n[o])return n[o].exports;var t=n[o]={exports:{},id:o,loaded:!1};return e[o].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}var n={};return r.m=e,r.c=n,r.p="",r(0)}([function(e,r,n){var o=n(1),t=n(3);e.exports=n(2),o.module(e.exports).config(["asyncBindConfigProvider",function(e){e.fromPromise=t.Observable.fromPromise,e.fromValue=t.Observable.of,e.map=t.Observable.prototype.map,e.switchMap=t.Observable.prototype.switchMap}])},function(r,n){r.exports=e},function(e,r,n){var o=n(1);e.exports="filearts.angularObserve";var t=o.module(e.exports,[]);t.provider("asyncBindConfig",[function(){this.fromValue=function(){throw new Error("You need to overwrite `asyncBindConfig.fromValue`.")},this.fromPromise=function(){throw new Error("You need to overwrite `asyncBindConfig.fromPromise`.")},this.map=function(){throw new Error("You need to overwrite `asyncBindConfig.map`.")},this.switchMap=function(){throw new Error("You need to overwrite `asyncBindConfig.switchMap`.")},this.$get=function(){return this}}]),t.directive("asyncBind",["$compile","$q","$rootScope","$timeout","asyncBindConfig",function(e,r,n,t,i){function u(e,r){var o=(r.asyncBind||r.source).split(/\s+as\s+/i),t=o.shift().split("."),u=o[0]||"$value",a=t.shift(),f=s(e,u);return e.empty(),function(e,r,o){function s(e){function r(e){var r=typeof e;return"boolean"===r||"number"===r||"string"===r}var n=!r(y[u])||!r(e);y[u]=e,d("active",n)}function p(e){d("complete")}function l(e){y.$error=e,d("error")}function d(e,n){if(n||e!==v){var o=f[e];if(m&&m.$destroy(),!o)return void r.empty();m=y.$new(),v=e,o(m,function(e){r.empty(),r.append(e)})}y.$root.$$phase||y.$digest(!0)}var m,v,h,y=n.$new(!0,e);e.$watch(a,function(e){function r(e){var r=e.shift(),o=e;return function(e){var t=e[r];return t?n(o,t):i.fromValue()}}function n(e,n){var o=c(n);return e.length?i.switchMap.call(o,r(e)):o}h&&(h.unsubscribe(),h=null),d("loading"),h=n(t,e).subscribe(s,l,p)}),e.$on("$destroy",function(){h&&(h.unsubscribe(),h=null)})}}function c(e){return e&&"function"==typeof e.subscribe?e:e&&"function"==typeof e.then?i.fromPromise(e):i.fromValue(e)}function s(r,n){var t={},i={loading:[],active:[],error:[],complete:[]},u=[];o.forEach(r.contents(),function(e){switch(e.nodeName.toLowerCase()){case"loading":return i.loading.push.apply(i.loading,e.childNodes);case"active":return i.active.push.apply(i.active,e.childNodes);case"error":return i.error.push.apply(i.error,e.childNodes);case"complete":return i.complete.push.apply(i.complete,e.childNodes);default:return u.push(e)}});var c=!1;if(o.forEach(i,function(r,n){if(r.length){c=!0;var i=o.element(r).clone();t[n]=e(i)}}),!c){u.length||u.push(document.createTextNode("{{"+n+"}}"));var s=o.element(u).clone(),a=o.element(u).clone();t.active=e(s),t.complete=e(a)}return t}return{restrict:"EA",scope:!0,compile:u}}])},function(e,n){e.exports=r}])}); |
{ | ||
"name": "angular-observe", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "Angular directive for representing the different states of an Observable.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/angular-observe.js", |
# Introducing the `async-bind` directive | ||
[![Join the chat at https://gitter.im/ggoodman/angular-observe](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ggoodman/angular-observe?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
Subscribe to an observable and render different markup depending on the observable's state. | ||
@@ -4,0 +6,0 @@ |
@@ -43,2 +43,4 @@ var Angular = require('angular'); | ||
tElement.empty(); | ||
return function postLink($scope, $element, $attrs) { | ||
@@ -50,4 +52,2 @@ var childScope; | ||
$element.empty(); | ||
$scope.$watch(sourceModel, function (source) { | ||
@@ -171,6 +171,6 @@ if (subscription) { | ||
switch (node.nodeName.toLowerCase()) { | ||
case 'loading': return stateTemplates.loading.push(node); | ||
case 'active': return stateTemplates.active.push(node); | ||
case 'error': return stateTemplates.error.push(node); | ||
case 'complete': return stateTemplates.complete.push(node); | ||
case 'loading': return stateTemplates.loading.push.apply(stateTemplates.loading, node.childNodes); | ||
case 'active': return stateTemplates.active.push.apply(stateTemplates.active, node.childNodes); | ||
case 'error': return stateTemplates.error.push.apply(stateTemplates.error, node.childNodes); | ||
case 'complete': return stateTemplates.complete.push.apply(stateTemplates.complete, node.childNodes); | ||
default: return template.push(node); | ||
@@ -197,6 +197,7 @@ } | ||
var clone = Angular.element(template).clone(); | ||
var active = Angular.element(template).clone(); | ||
var complete = Angular.element(template).clone(); | ||
stateLinkFunctions.active = $compile(clone); | ||
stateLinkFunctions.complete = $compile(clone.clone()); | ||
stateLinkFunctions.active = $compile(active); | ||
stateLinkFunctions.complete = $compile(complete); | ||
} | ||
@@ -203,0 +204,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
4
63
64482
17
1121