我正在尝试实现一个boostrap轮播和Angular 4的RouteModule。
如果我重新加载页面,旋转木马工作正常,但是当我使用routerLink进入网络内部时,永远不会按预期循环。
我猜测角度会动态添加html并且不会触发js以使其开始图像化。
有一种方法可以在组件的负载上重新加载boostrap组件,对吧?
保存旋转木马的组件是" ProyectorZonaComponent"这里是app.module和用于导航的代码块
欣赏你!
app.module.ts
const appRoutes: Routes = [
{ path: 'rosario', component: ProyectorZonaComponent, data: { title: 'Tv Rosario', zona: 'rosario' } },
{ path: 'lima', component: ProyectorZonaComponent, data: { title: 'Tv Lima', zona: 'lima' } },
{ path: 'bsas', component: ProyectorZonaComponent, data: { title: 'Tv Buenos Aires', zona: 'bsas' }},
{ path: 'neco', component: ProyectorZonaComponent, data: { title: 'Tv Necochea', zona: 'neco' }},
{ path: 'home', component: HomeComponent, data: { title: 'Tv' } },
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{ path: '**', component: HomeComponent }
];
@NgModule({
declarations: [
AppComponent,
ProyectorZonaComponent,
HomeComponent
],
imports: [
BrowserModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFireDatabaseModule, // imports firebase/database, only needed for database features
AngularFireAuthModule, // imports firebase/auth, only needed for auth features
RouterModule.forRoot(appRoutes)
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
home.component.html
<ul>
<li> <a routerLink="/rosario">Rosario</a></li>
<li><a routerLink="/neco">Necochea, Bahia Blanca</a></li>
<li><a routerLink="/lima">Lima, Las Palmas</a></li>
<li><a routerLink="/bsas">Buenos Aires</a></li>
</ul>
答案 0 :(得分:0)
在app.module
中添加import { LocationStrategy, HashLocationStrategy } from '@angular/common';
@NgModule({
...
providers: [
{
provide: LocationStrategy,
useClass: HashLocationStrategy
}
]
...
})