已修复:我们必须添加到 app.module.ts ->声明中:[WelcomeComponent,DashboardComponent]
我想在Angular中创建一条路线,我已经创建了一个文件app.routes.ts 使用以下代码
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {WelcomeComponent} from './welcome/welcome.component';
import {DashboardComponent} from './dashboard/dashboard.component';
import { ModuleWithProviders } from '@angular/core'
const routes: Routes = [
{path: 'welcome', component: WelcomeComponent},
{path: 'dashboard', component: DashboardComponent}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes)
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRouters {
}
但是,如果我打开localhost或localhost / welcome或/ dashboard,则会出现空白页。 谢谢
编辑:这是我的app.modules.ts文件
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MaterialModule} from './material.module';
import {FlexLayoutModule} from '@angular/flex-layout';
import {AppRouters} from './app.routes';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserModule,
BrowserAnimationsModule,
MaterialModule,
FlexLayoutModule,
AppRouters,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
答案 0 :(得分:1)
您需要在app.modules.ts中声明组件:
// update opengl projection matrix to vulkan conventions:
// Vulkan clip space has inverted Y and half Z ( Z - [0, 1] instead of [-1, 1])
float zNear = r_znear->value;
float m10 = -zFar / (zFar - zNear);
float py = tan(fovY * (M_PI / 360.0f));
float px = tan(fovX * (M_PI / 360.0f));
mvp[0] = 1.0f / px;
mvp[1] = 0;
mvp[2] = 0;
mvp[3] = 0;
mvp[4] = 0;
mvp[5] = -1.0f / py;
mvp[6] = 0;
mvp[7] = 0;
mvp[8] = 0;
mvp[9] = 0;
mvp[10] = m10;
mvp[11] = -1.0f;
mvp[12] = 0;
mvp[13] = 0;
mvp[14] = zNear * m10;
mvp[15] = 0;