- import { Component, Input, OnChanges, SimpleChange } from '@angular/core';
- @Component({
- selector: 'app-version-child',
- template: `
- <h3>Version {{major}}.{{minor}}</h3>
- <h4>Change log:</h4>
- <ul>
- <li *ngFor="let change of changeLog">{{change}}</li>
- </ul>
- `
- })
- export class VersionChildComponent implements OnChanges {
- @Input() major: number;
- @Input() minor: number;
- changeLog: string[] = [];
- ngOnChanges(changes: {[propKey: string]: SimpleChange}) {
- let log: string[] = [];
- for (let propName in changes) {
- let changedProp = changes[propName];
- let to = JSON.stringify(changedProp.currentValue);
- if (changedProp.isFirstChange()) {
- log.push(`Initial value of ${propName} set to ${to}`);
- } else {
- let from = JSON.stringify(changedProp.previousValue);
- log.push(`${propName} changed from ${from} to ${to}`);
- }
- }
- this.changeLog.push(log.join(', '));
- }
- }
Hiển thị các bài đăng có nhãn Component Interaction. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Component Interaction. Hiển thị tất cả bài đăng
Intercept input property changes with ngOnChanges()
Đăng ký:
Nhận xét (Atom)
AH00035 permission denied
sudo chmod 751 /home/ubuntu sudo chown -R ubuntu:www-data /home/ubuntu/genealogy-giapha sudo chmod -R 750 /home/ubuntu/genealogy...
-
html5 video - What is a blob URL and why it is used? - Stack Overflow Blob URLs (ref W3C , official name) or Object-URLs (ref. MDN and ...
-
Source: https://indepth.dev/stop-using-shared-material-module/ This article describes an experiment that shows why using the SharedMate...
-
Source: https://www.infoworld.com/article/3206264/application-development/how-to-perform-partial-updates-to-rest-web-api-resources.html T...