有什么方法我只能强制Angular 5通用应用程序的特定路径的浏览器渲染?我在app.module.shared.ts中有以下路线
@NgModule({
declarations: [...],
imports: [
......
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: HomeComponent },
{ path: 'auth-callback', component: AuthCallbackComponent},
{ path: '**', redirectTo: 'home' }
]
)
],
providers: []
})
Run Code Online (Sandbox Code Playgroud)
我希望mysite.com/auth-callback只能在浏览器中呈现,而不是在服务器端呈现.感谢您的帮助,未能找到任何帮助信息.
我坚持" 无法绑定到'ngModule',因为它不是'select'的已知属性. "错误.该解决方案应该在app.module.shared.ts文件中导入FormsModule.我做了,但我仍然得到同样的错误.
app.module.shared.t
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { HttpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './components/app/app.component';
import { NavMenuComponent } from './components/navmenu/navmenu.component';
import { HomeComponent } from './components/home/home.component';
import { StatisticComponent} from './components/statistic/statistic.component';
import { StatisticViewComponent } from './components/statisticview/statisticview.component';
import { StatService } from './components/services/stat.service';
@NgModule({
declarations: [
AppComponent,
NavMenuComponent,
HomeComponent,
StatisticComponent,
StatisticViewComponent
],
imports: [ …Run Code Online (Sandbox Code Playgroud)