devyumao / angular2-busy

Show busy/loading indicators on any promise, or on any Observable's subscription.
http://devyumao.github.io/angular2-busy/demo/asset/
MIT License
314 stars 102 forks source link

Import BusyModule in my module,all routers loadChildren can not use #60

Open panglisen opened 7 years ago

panglisen commented 7 years ago

it is AppModule @NgModule({ declarations: [ AppComponent, LoginComponent ], imports: [ BrowserModule, FormsModule, HttpModule, CommonModule, BrowserAnimationsModule, BusyModule, RouterModule, RouterModule.forRoot(indexRoutes) ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } it is Router export const indexRoutes: Routes = [ { path: '', redirectTo: '/login.html', pathMatch: 'full' }, { path: 'login.html', component: LoginComponent }, { path: 'test', loadChildren: './test/index.module#IndexModule' } ]; it is my project image

when use ng serve --prod start image

i find all loadChildren can not use,

How to solve?

panglisen commented 7 years ago

my angular version is 4.1.3

deprecatednw commented 7 years ago

We must not provide Compiler as JitCompiler. Instead we must provide and inject the Compiler2 extends Compiler. Provide: Compiler2, usefactory: ...

Xepe commented 7 years ago

yes @apoterenko that was the solution, I created a new CustomCompiler extends Compiler, and I replaced it in the busy component and the aot compilation works

I will try to create a MR tomorrow.

I did the commit in here https://github.com/Tixifni/angular2-busy/commit/6bdb3343399dc96fc3dbf14cc8bdf6040a7d887a

Also I created https://www.npmjs.com/package/tixif-ngx-busy for testing

Regards.

ipassynk commented 7 years ago

@Xepe, can you please explain why do you need to Compiler to make JIT compiler work in AOT?

Xepe commented 7 years ago

@ipassynk I am not totally sure, the issue that I found is because the JIT Compiler is set for the Compiler and for JIT is ok but for AOT it does not work, I got some error like "the compiler is not loaded", for that reason I created a extends of Compiler and I setup that customCompiler where the component need it.

atluri64 commented 7 years ago

I am having the same issue. will it be fixed in near future?

DrMabuse23 commented 6 years ago

@Xepe maybe you can add here the customCompiler example ?