angular-docs-cn/aio/dist/announcement-bar-announceme...

2 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{"5UAH":function(n,e,t){"use strict";t.r(e),t.d(e,"AnnouncementBarModule",function(){return p});var r=t("ofXK"),c=t("tk/3"),o=t("PCNd"),a=t("JIr8"),s=t("lJxs"),i=t("jn67"),u=t("fXoL"),b=t("vHPH");function m(n,e){if(1&n&&(u.Tb(0,"div",1),u.Tb(1,"div",2),u.Pb(2,"img",3),u.Pb(3,"p",4),u.Tb(4,"a",5),u.Ac(5,"Learn More"),u.Sb(),u.Sb(),u.Sb()),2&n){const n=u.ec();u.Cb(2),u.jc("src",n.announcement.imageUrl,u.uc),u.Cb(1),u.jc("innerHTML",n.announcement.message,u.tc),u.Cb(1),u.jc("href",n.announcement.linkUrl,u.uc)}}const l=i.a+"announcements.json";let f=(()=>{class n{constructor(n,e){this.http=n,this.logger=e}ngOnInit(){this.http.get(l).pipe(Object(a.a)(n=>(this.logger.error(new Error(`${l} request failed: ${n.message}`)),[])),Object(s.a)(n=>this.findCurrentAnnouncement(n)),Object(a.a)(n=>(this.logger.error(new Error(`${l} contains invalid data: ${n.message}`)),[]))).subscribe(n=>this.announcement=n)}findCurrentAnnouncement(n){return n.filter(n=>new Date(n.startDate).valueOf()<Date.now()).filter(n=>new Date(n.endDate).valueOf()>Date.now())[0]}}return n.\u0275fac=function(e){return new(e||n)(u.Ob(c.a),u.Ob(b.a))},n.\u0275cmp=u.Ib({type:n,selectors:[["aio-announcement-bar"]],decls:1,vars:1,consts:[["class","homepage-container",4,"ngIf"],[1,"homepage-container"],[1,"announcement-bar"],["alt","",3,"src"],[3,"innerHTML"],[1,"button",3,"href"]],template:function(n,e){1&n&&u.zc(0,m,6,3,"div",0),2&n&&u.jc("ngIf",e.announcement)},directives:[r.k],encapsulation:2}),n})(),p=(()=>{class n{constructor(){this.customElementComponent=f}}return n.\u0275mod=u.Mb({type:n}),n.\u0275inj=u.Lb({factory:function(e){return new(e||n)},imports:[[r.c,o.a,c.b]]}),n})()}}]);
//# sourceMappingURL=announcement-bar-announcement-bar-module-es2015.1b5b762c9c8837c770f8.js.map