public Firstname: FormControl = new FormControl("");
public Lastname: FormControl = new FormControl("");
public Email: FormControl = new FormControl("");
public Address: FormControl = new FormControl("");
constructor() {}
app.component.ts
import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {FormsModule} from '@angular/forms';
import {AppRouting} from './app.routing.js';
import {AppComponent} from './app.component';
import {HomeComponent} from './home/home.component';
import {ContactComponent} from './contact/contact.component';
import {AboutComponent} from './about/about.component';
import {CapitalizePipe} from './pipes/capitalize.pipe';
import { ReactiveFormsModule } from '@angular/forms';
import { Logger } from './services/logger';
import { Logout } from './services/logger';
import { Colors } from './services/colors';
@NgModule({
imports: [BrowserModule,
FormsModule,
AppRouting,
ReactiveFormsModule],// other mudule that we need to use
declarations: [
AppComponent,
HomeComponent,
ContactComponent,
AboutComponent,
CapitalizePipe],//that will be components in our app
providers: [Logger, Colors],
bootstrap: [AppComponent]//tells the core component that we want to use
})
export class AppModule{}
`
I get the following error when I route to about page:
here about.component.ts ` import{ Component } from '@angular/core'; import { FormControl } from '@angular/forms';
@Component({ selector:"about-page", templateUrl: 'app/about/about.component.html' })
export class AboutComponent{
}
about.component.html
Value: {{Lastname.value}}
app.component.ts
import {NgModule} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; import {FormsModule} from '@angular/forms'; import {AppRouting} from './app.routing.js'; import {AppComponent} from './app.component'; import {HomeComponent} from './home/home.component'; import {ContactComponent} from './contact/contact.component'; import {AboutComponent} from './about/about.component'; import {CapitalizePipe} from './pipes/capitalize.pipe'; import { ReactiveFormsModule } from '@angular/forms'; import { Logger } from './services/logger'; import { Logout } from './services/logger'; import { Colors } from './services/colors';@NgModule({ imports: [BrowserModule, FormsModule, AppRouting, ReactiveFormsModule],// other mudule that we need to use declarations: [ AppComponent, HomeComponent, ContactComponent, AboutComponent, CapitalizePipe],//that will be components in our app providers: [Logger, Colors], bootstrap: [AppComponent]//tells the core component that we want to use }) export class AppModule{} `