2019-10-23 13:30:32 +00:00
|
|
|
/**
|
|
|
|
|
* @license
|
2020-05-19 19:08:49 +00:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2019-10-23 13:30:32 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
2024-09-20 15:23:15 +00:00
|
|
|
* found in the LICENSE file at https://angular.dev/license
|
2019-10-23 13:30:32 +00:00
|
|
|
*/
|
|
|
|
|
import {Component} from '@angular/core';
|
|
|
|
|
|
|
|
|
|
@Component({
|
2020-03-18 16:01:41 +00:00
|
|
|
selector: 'app-root',
|
2019-10-23 13:30:32 +00:00
|
|
|
template: `
|
|
|
|
|
<button id="create" (click)="create()">Create</button>
|
|
|
|
|
<button id="update" (click)="update()">Update</button>
|
|
|
|
|
<button id="destroy" (click)="destroy()">Destroy</button>
|
2024-01-17 15:43:17 +00:00
|
|
|
<class-bindings *ngIf="show" [msg]="msg" [list]="list"
|
|
|
|
|
><class-bindings> </class-bindings
|
|
|
|
|
></class-bindings>
|
|
|
|
|
`,
|
2024-10-11 12:35:38 +00:00
|
|
|
standalone: false,
|
2019-10-23 13:30:32 +00:00
|
|
|
})
|
|
|
|
|
export class AppComponent {
|
|
|
|
|
show = false;
|
|
|
|
|
msg = 'hello';
|
2024-01-17 15:43:17 +00:00
|
|
|
list: {i: number; text: string}[] = [];
|
2019-10-23 13:30:32 +00:00
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
for (let i = 0; i < 1000; i++) {
|
|
|
|
|
this.list.push({i, text: 'foobar' + i});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-13 23:40:21 +00:00
|
|
|
create() {
|
|
|
|
|
this.show = true;
|
|
|
|
|
}
|
2019-10-23 13:30:32 +00:00
|
|
|
|
|
|
|
|
update() {
|
|
|
|
|
this.msg = this.msg === 'hello' ? 'bye' : 'hello';
|
|
|
|
|
this.list[0].text = this.msg;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-13 23:40:21 +00:00
|
|
|
destroy() {
|
|
|
|
|
this.show = false;
|
|
|
|
|
}
|
2020-03-18 16:01:41 +00:00
|
|
|
}
|