Skip to main content

Posts

Showing posts with the label Angular 6 Form submit Example

Angular 6 Form submit Example

Create Anular6 project – using below command ng new project_name Go to the project - project_name directory Create the user component – using below command ng g component user Create the user class export class User {    public id : number ;    public name : string ;    public age : string ;    public url ?: string } Create user component - user.component.ts import { Component , OnInit } from '@angular/core' ; import { HttpClient , HttpHeaders } from   '@angular/common/http' ; import { FormBuilder , FormGroup , Validators } from '@angular/forms' ; import { User } from '../user; @ Component ({   selector: 'app-user' ,   templateUrl: './user.component.html' ,   styleUrls: [ './user.component.css' ] }) export class UserComponent implements OnInit {   model = new User ();//user model object   constructor () { }   ngOnInit (...