/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
modules/benchmarks/src/class_bindings/app.component.ts
45 строк
1 KB
Matthieu Riegler
refactor(core): Migrate modules directory with the schematic. (#58160)
14 окт 2024, 17:58
14 окт 2024, 17:58
afcc3ee
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {Component} from '@angular/core'; @Component({ selector: 'app-root', template: ` <button id="create" (click)="create()">Create</button> <button id="update" (click)="update()">Update</button> <button id="destroy" (click)="destroy()">Destroy</button> <class-bindings *ngIf="show" [msg]="msg" [list]="list" ><class-bindings> </class-bindings ></class-bindings> `, standalone: false, }) export class AppComponent { show = false; msg = 'hello'; list: {i: number; text: string}[] = []; constructor() { for (let i = 0; i < 1000; i++) { this.list.push({i, text: 'foobar' + i}); } } create() { this.show = true; } update() { this.msg = this.msg === 'hello' ? 'bye' : 'hello'; this.list[0].text = this.msg; } destroy() { this.show = false; } }