ngx-cache-if
Version:
Angular *ngIf directive that cache content. *ngxCacheIf directive render content when needed and cache it for reuse.
2 lines • 1.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ngx-cache-if",["exports","@angular/core"],t):t(e["ngx-cache-if"]={},e.ng.core)}(this,function(e,t){"use strict";var n=function(){function e(e,t,n,r,i){this.templateRef=e,this.viewContainer=t,this.el=n,this.renderer=r,this.cfr=i,this.loaded={}}return e.prototype.ngOnChanges=function(e){if(this.loaded[this.templateRef.elementRef.nativeElement.nodeName])try{e.ngxCacheIf.currentValue?this.viewContainer.insert(this.loaded[this.templateRef.elementRef.nativeElement.nodeName]):this.viewContainer.detach()}catch(t){console.log(t)}else e.ngxCacheIf.currentValue&&(this.viewContainer.clear(),this.loaded[this.templateRef.elementRef.nativeElement.nodeName]=this.viewContainer.createEmbeddedView(this.templateRef))},e.decorators=[{type:t.Directive,args:[{selector:"[ngxCacheIf]"}]}],e.ctorParameters=function(){return[{type:t.TemplateRef},{type:t.ViewContainerRef},{type:t.ElementRef},{type:t.Renderer2},{type:t.ComponentFactoryResolver}]},e.propDecorators={ngxCacheIf:[{type:t.Input}]},e}(),r=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[],declarations:[n],exports:[n]}]}],e}();e.NgxCacheIfDirective=n,e.NgxCacheIfModule=r,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ngx-cache-if.umd.min.js.map