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); | |
} | |
} |
Angular @Input() property changes detection
Source: https://ngdev.space/angular-2-input-property-changes-detection-3ccbf7e366d2
Đăng ký:
Đăng Nhận xét (Atom)
Is it okay to use both fetchpriority="high" and loading="eager" in img tag?
https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...
-
letsencrypt "Certbot doesn't know how to automatically configure the web server on this system" (repusic.com) sudo yum inst...
-
https://medium.com/@mair.swartz/creating-xml-document-with-react-c6c37f5c608b I wanted to see if React could be used to compose anything mo...
-
Modify File Permissions with chmod | Linode Modify File Permissions with chmod The chmod command allows users to change read and write per...
Không có nhận xét nào:
Đăng nhận xét