我已经有一个正在运行的 Angular 应用程序,因为有功能扩展,我必须实现该应用程序的路由和登录页面。以前没有路由,作为路由的一部分,我添加了以下代码。
app.modules.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { SignUpComponent } from './sign-up/sign-up.component';
import { LoginComponent } from './login/login.component';
import {CommonModule} from "@angular/common";
import {FormsModule , ReactiveFormsModule } from '@angular/forms';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
SignUpComponent,
LoginComponent,
],
imports: [
BrowserModule,
AppRoutingModule,
CommonModule,
ReactiveFormsModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class …Run Code Online (Sandbox Code Playgroud)