Zone.js:654 Unhandled Promise rejection: Network error. ; Zone: <root>

widgetsjs
website-card
embeddedtimeline

#1

I am using twitter timeline in angular app.

I have this dashboard.component.html

Tweets

and inside the component.ts i have the below code.

ngAfterViewInit() {

            !function(d,s,id){
                var js: any,
                    fjs=d.getElementsByTagName(s)[0],
                    p='https';
                if(!d.getElementById(id)){
                    js=d.createElement(s);
                    js.id=id;
                    js.src=p+"://platform.twitter.com/widgets.js";
                    fjs.parentNode.insertBefore(js,fjs);
                }
            }
            (document,"script","twitter-wjs");


this.sub = this._router.events.subscribe(val => {
  if (val instanceof NavigationEnd) {
    (<any>window).twttr = (function (d, s, id) {
      let js: any, fjs = d.getElementsByTagName(s)[0],
          t = (<any>window).twttr || {};
      if (d.getElementById(id)) return t;
      js = d.createElement(s);
      js.id = id;
      js.src = "https://platform.twitter.com/widgets.js";
      fjs.parentNode.insertBefore(js, fjs);

      t._e = [];
      t.ready = function (f: any) {
          t._e.push(f);
      };

      return t;
    }(document, "script", "twitter-wjs"));

    if ((<any>window).twttr.ready())
      (<any>window).twttr.widgets.load();

  }
});

}

ngOnDestroy() {

}

when i execute the timeline is getting displayed but i am facing error in console for each new tweet update.

What might be the issue with .?


#2

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.