interrupts routing I came across a problem related issue . Angular 2 seems to be heavily dep...">

Angular 2 RC5 <base href = "..."> interrupts routing

I came across a problem related issue <base href="...">. Angular 2 seems to be heavily dependent on this tag. However, the tag itself affects ads <svg>...</svg>in a way that is not suitable for my case ( information about this problem on the Internet is very correctly described there ). But when I delete mine <base href="...">, the application instantly breaks.

After hiding the solution in a few days, I found a way to make the application work at least somehow without <base href="...">

@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    routing
  ],
  declarations: [
    AppComponent,
    HeroesComponent,
    DashboardComponent,
    HeroDetailComponent
  ],
  providers: [
    HeroService, {
      provide: APP_BASE_HREF, // <------------ this guy here saves the day
      useValue: '/'
    }
  ],
  bootstrap: [ AppComponent ]
})
export class AppModule {
}

<base href="..."> . " ", , .

plunkr, Angular <base href="...">

plunkr

plunkr

, .

, <base href="...">, Angular 2. , ?

enter image description here enter image description here

+4
1

{ provide: APP_BASE_HREF, useValue: '/' }

<base href="...">, SVG <base href="...">.

. https://github.com/angular/angular/issues/8939

+1

Source: https://habr.com/ru/post/1651729/


All Articles