Angular @Input() property changes detection

Source: https://ngdev.space/angular-2-input-property-changes-detection-3ccbf7e366d2
import {
Component, Input,
OnInit,
OnChanges, SimpleChanges, SimpleChange
} from '@angular/core';
@Component({
selector: 'my-last-name',
template: `
<h2>Last name: {{_name}} ({{ name }})</h2>
`,
})
export class OtherChildComponent implements OnChanges, OnInit {
@Input() name: string;
private _name: string;
constructor() {}
ngOnChanges(changes: SimpleChanges) {
const name: SimpleChange = changes.name;
console.log('prev value: ', name.previousValue);
console.log('got name: ', name.currentValue);
this._name = name.currentValue.toUpperCase();
}
ngOnInit() {
console.log('on init');
console.log(this.name);
}
}

Không có nhận xét nào:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...