Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'ERROR TypeError: Cannot read property 'UserName' of undefined
- TypeError: _co.user is undefined
- <input type="text" name="UserName" #UserName ="ngModel" [(ngModel)]="user.UserName">
- import { Component, OnInit } from '@angular/core';
- import { User } from '../shared/user.model';
- import { NgForm } from '@angular/forms';
- import { UserService } from '../shared/user.service';
- @Component({
- selector: 'app-sign-up',
- templateUrl: './sign-up.component.html',
- styleUrls: ['./sign-up.component.css']
- })
- export class SignUpComponent implements OnInit {
- user : User;
- constructor( private userService : UserService) { }
- ngOnInit() {
- }
- OnSubmit(form : NgForm){
- this.userService.addUser(form.value).subscribe((data : any)=> {
- if(data.Succeeded ==true){
- console.log("transferred successfull");
- }
- });
- }
- }
- export class User {
- UserName: string;
- Password: string;
- Email: string;
- FirstName: string;
- LastName: string;
- }
Add Comment
Please, Sign In to add comment