jawadSharif / blader

Playground for azure portal like blade controls made with angular.

Home Page:https://www.tomware.ch/2018/02/12/blader-an-attempt-to-mimic-azure-portal-like-blades-with-angular/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

blader

Playground for azure portal like blade controls made with angular.

Blader

Lazy blades

If you want to use a blade in a lazy loaded module you need to configure the app.module with an appropriate PreloadingStrategy.

const APP_ROUTES = RouterModule.forRoot([
  { path: '', redirectTo: 'home', pathMatch: 'full' },
  { path: 'home', component: HomeComponent },
  { path: 'list', component: ListComponent },
  { path: 'detail', component: DetailComponent },
  { path: 'lazy', loadChildren: './lazy/lazy.module#LazyModule' }
], { preloadingStrategy: PreloadAllModules });

In your lazy loaded module you need to register the blade with a factory function. This is required so the injector mechanism of angular knows where to look for its dependencies.

export class LazyModule {
  public constructor(
    private _bladeRegistry: BladeRegistry,
    private _injector: Injector
  ) {
    console.log(`registering LazyBladeComponent...`);

    this._bladeRegistry.register(new BladeMetaData('lazy', LazyBladeComponent, () => {
      return this._injector
        .get(ComponentFactoryResolver)
        .resolveComponentFactory(LazyBladeComponent);
    }));

    console.log(this._bladeRegistry);
  }
}

About

Playground for azure portal like blade controls made with angular.

https://www.tomware.ch/2018/02/12/blader-an-attempt-to-mimic-azure-portal-like-blades-with-angular/


Languages

Language:TypeScript 89.5%Language:CSS 7.0%Language:JavaScript 2.7%Language:HTML 0.8%