/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
modules/playground/src/http/app/http_comp.ts
30 строк
790 B
Matthieu Riegler
feat(core): Set default Component changeDetection strategy to OnPush
25 мар 2026, 02:25
25 мар 2026, 02:25
eae8f7e
Код
Авторство
О чём код?
/** * @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 {HttpClient} from '@angular/common/http'; import {ChangeDetectionStrategy, Component} from '@angular/core'; @Component({ selector: 'http-app', template: ` <h1>people</h1> <ul class="people"> <li *ngFor="let person of people">hello, {{ person.name }}</li> </ul> `, standalone: false, changeDetection: ChangeDetectionStrategy.Eager, }) export class HttpCmp { people: {name: string}[] = []; constructor(http: HttpClient) { http .get('./people.json') .subscribe((people: unknown) => (this.people = people as {name: string}[])); } }