March 2018
Intermediate to advanced
364 pages
8h 21m
English
There are two things we need to do to support updating users:
Let's start with our component:
// edit-user.component.tsimport { Component, OnInit, Output, Input, EventEmitter } from "@angular/core";@Component({ selector: "edit-user", template: ` <div> <input [(ngModel)]="user.name" /> <button (click)="save.emit(user)" >Save</button> </div>`})export class EditUserComponent implements OnInit { private _user; @Input() get user() { return this._user; } set user(val) { this._user = Object.assign({}, val); } @Output() save = new EventEmitter(); constructor() {} ngOnInit() {}}
Here, we have ...
Read now
Unlock full access