1
많은 경로와 모듈을로드하는 각도 최종 앱이 있습니다. 콘솔에 "Zone is already loaded"오류가 나타나기 시작했고 이제는 두 번 표시됩니다.이미로드 된 영역을 어떻게 결정합니까?
나는 어떤 일이 일어나는지 알아 내려고 시도하기 위해 영역 객체를 살펴 봤지만, 어떤 영역이 무엇을해야할지 모른 채 해독하는 것은 거의 불가능합니다.
Main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './app/';
import {AppModule} from './app/app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule,[]);
app.module.ts (I는 수입 모두 생략)
@NgModule({
imports: [ BrowserModule, RouterModule.forRoot(appRoutes), SharedModule.forRoot(),
HomeModule, DocumentsModule, AboutModule, SettingsModule, FoodModule, CalculatorModule,
ThemesModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ],
providers: [ appRoutingProviders ]
})
export class AppModule {}
app.component.ts
@Component({
moduleId: module.id,
selector: 'kg-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.css']
})
export class AppComponent implements OnInit {
private items: MenuItem[];
appPageHeaderDivStyle: {};
selectedTheme: Theme;
errorMessage: string;
loggedIn: LoggedIn;
loggedInEmail: string = "";
isLoggedIn: boolean;
constructor(
private as: AppMenuService,
private ts: ThemeService,
private ss: SettingsService,
private ls: LoginService) {
}
ngOnInit() {
this.ts.getNewTheme()
.subscribe(
theme => this.selectedTheme = theme,
error => {
this.errorMessage = error
},
() => this.completeGetNewTheme()
);
this.ts.setTheme("Pepper-Grinder");
this.items = this.as.getNoLoginMenu();
this.ls.getLoggedIn()
.subscribe(
loggedIn => {
if (loggedIn.error != undefined && loggedIn.error === "" && loggedIn.email != "") {
this.items = this.as.getLoggedInMenu();
var us = this.ss.getUserSettings();
if (us != undefined && us.theme != null && us.theme != "") {
this.ts.setTheme(us.theme);
}
}
else {
this.items = this.as.getNoLoginMenu();
this.ts.setTheme("Pepper-Grinder");
}
this.completeLoggedIn(loggedIn.email);
});
}
completeLoggedIn(email: string) {
this.loggedInEmail = email;
this.isLoggedIn = (this.loggedInEmail.length > 0);
}
completeGetNewTheme() {
this.appPageHeaderDivStyle = this.ts.getAppPageHeaderDivStyle();
}
동일한 문제가 발생하지만 zone.js를 다시로드해야합니다. 나는 그 짐을 적재 할 필요가 없는지를 확인하려고 노력한다. –