| 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)
api feed with published=false?
Câu trả lời ngắn gọn là: CÓ . Trên thực tế, đây chính là cách chuẩn nhất để tạo các bài viết chưa hiển thị công khai (bao gồm Bản nháp, B...
-
Source: https://indepth.dev/stop-using-shared-material-module/ This article describes an experiment that shows why using the SharedMate...
-
Basic usage | Documentation | Poetry - Python dependency management and packaging made easy (python-poetry.org) Activating the virtual env...
-
https://azdigi.com/blog/en/webserver-panel-en/directadmin-en/fix-the-error-cxxabi-1-3-9-not-found-on-centos-7-running-directadmin/ In this ...
Không có nhận xét nào:
Đăng nhận xét