angular - Error in angular2 with routing. More tasks executed then were scheduled, platform-browser.umd.js:937 -


i'm new angular 2 , i'm using latest angular 2 (rc5) , want introduce navigation, works isn't loading default option (hospitalization) have click in option, , app navigate between different options of menu have problem in console:

exception: error: more tasks executed scheduled. browserdomadapter.logerror  @platform-browser.umd.js:937  platform-browser.umd.js:937 error: more tasks executed scheduled.     @ zonedelegate._updatetaskcount (zone.js:398)     @ zonedelegate.invoketask (zone.js:369)     @ zone.runtask (zone.js:265)     @ zonetask.invoke (zone.js:433)     @ xmlhttprequest.<anonymous> (zone.js:93)     @ zonedelegate.invoketask (zone.js:365)     @ object.oninvoketask (core.umd.js:9236)     @ zonedelegate.invoketask (zone.js:364)     @ zone.runtask (zone.js:265)     @ xmlhttprequest.zonetask.invoke (zone.js:433) 

my main.ts is:

// main entry point import { platformbrowserdynamic } '@angular/platform-browser-dynamic'; import { appmodule } './app.module';  platformbrowserdynamic().bootstrapmodule(appmodule); 

my app.module.ts is:

import { ngmodule }       '@angular/core'; import { browsermodule }  '@angular/platform-browser'; import { formsmodule }    '@angular/forms'; import { platformbrowserdynamic } '@angular/platform-browser-dynamic'; import { httpmodule } '@angular/http';  import { maincomponent }    './component/main/component-main'; import { loadservice }      './service/load-service'; import { routing } './app.routing';  import { locationscomponent }   './component/locations/component-locations'; import { hospitalizationcomponent }   './component/hospitalization/component-hospitalization'; import { episodescomponent } './component/episodes/component-episodes'; import { listingscomponent } './component/listings/component-listings'; import { reportscomponent } './component/reports/component-reports';  @ngmodule({   imports: [     browsermodule,     httpmodule,     formsmodule,     routing   ],   declarations: [     maincomponent,     hospitalizationcomponent,     locationscomponent,     episodescomponent,     listingscomponent,     reportscomponent   ],   providers: [     loadservice   ],   bootstrap: [ maincomponent ] }) export class appmodule { } 

my app.routing.ts is:

import { modulewithproviders }  '@angular/core'; import { routes, routermodule } '@angular/router';  import { locationscomponent }   './component/locations/component-locations'; import { hospitalizationcomponent }   './component/hospitalization/component-hospitalization'; import { episodescomponent } './component/episodes/component-episodes'; import { listingscomponent } './component/listings/component-listings'; import { reportscomponent } './component/reports/component-reports';  const approutes: routes = [   {     path: '',     redirectto: '/hospitalization',     pathmatch: 'full'   },   {     path: 'hospitalization',     component: hospitalizationcomponent   },   {     path: 'locations',     component: locationscomponent   },   {     path: 'episodes',     component: episodescomponent   },   {     path: 'listings',     component: listingscomponent   },   {     path: 'reports',     component: reportscomponent   } ];  export const approutingproviders: any[] = [  ];  export const routing: modulewithproviders = routermodule.forroot(approutes); 

and component-main.ts is:

import { component, input, output } '@angular/core'; import { patientservice }           '../../service/patient-service'; import { messageservice }           '../../service/message-service'; import { loginservice }             '../../service/login-service'; import { loadservice }              '../../service/load-service'; import { userbean }                 '../../bean/user-bean'; import { headercomponent }          './component-header'; import { footercomponent }          './component-footer'; import { menuleftcomponent }    './component-menu-left'; import { hospitalizationcomponent }     '../hospitalization/component-hospitalization';  @component({     selector: 'component-main',     templateurl: './resources/template/component-main.html',     styleurls: ['./resources/css/component-main.css'],     moduleid: module.id,     providers: [messageservice, loginservice, loadservice],     directives: [headercomponent, footercomponent, menuleftcomponent, hospitalizationcomponent] })  export class maincomponent {     // private attributes     private _userloaded: boolean = false;     private _messageloaded: boolean = false;     private _error: = null;      private _local: boolean = true;      public _patient: any;     public _user: userbean;      constructor(private _messageservice: messageservice,         private _loginservice: loginservice,         private _loadservice: loadservice) {          this.loaduser(_loginservice);         this.loadmessages(_messageservice);     }      isloaded(): boolean {         return this._messageloaded /*&& this._patientloaded*/ && this._userloaded;     }      messageservice(): messageservice {         return this._messageservice;     }      user(): userbean {         return this._user;     }      // load user     private loaduser(_loginservice: loginservice) {         var _user: userbean;         var _self: = this;         _self._userloaded = false;         _self._loadservice.startrequest();         if (this._local) {             var user: userbean = _self._loginservice.getloginuser();             this.onusersucess(user);         } else {             _self._loginservice.getlogindata().subscribe(_user => this.onusersucess(_user));         }     }      // load messages     private loadmessages(_messageservice: messageservice) {         var _self: = this;         _self._messageloaded = false;         _self._loadservice.startrequest();         _messageservice.initialize(window.navigator.language, function(correct: boolean, error: = null) {             _self._messageloaded = true;             _self._loadservice.endrequest();         });     }      // on user loaded     onusersucess(data: userbean): void {         this._userloaded = true;         this._loadservice.endrequest();         this._user = data;     } } 

it isn't loading default option because had synchronize call. have changed call asynchronize , loads default option.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -