/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/forms/src/directives/error_examples.ts
61 строка
1 KB
Joey Perrott
refactor: update license text to point to angular.dev (#57901)
24 сен 2024, 16:33
24 сен 2024, 16:33
9dbe6fc
Код
Авторство
О чём код?
/** * @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 */ export const formControlNameExample = ` <div [formGroup]="myGroup"> <input formControlName="firstName"> </div> In your class: this.myGroup = new FormGroup({ firstName: new FormControl() });`; export const formGroupNameExample = ` <div [formGroup]="myGroup"> <div formGroupName="person"> <input formControlName="firstName"> </div> </div> In your class: this.myGroup = new FormGroup({ person: new FormGroup({ firstName: new FormControl() }) });`; export const formArrayNameExample = ` <div [formGroup]="myGroup"> <div formArrayName="cities"> <div *ngFor="let city of cityArray.controls; index as i"> <input [formControlName]="i"> </div> </div> </div> In your class: this.cityArray = new FormArray([new FormControl('SF')]); this.myGroup = new FormGroup({ cities: this.cityArray });`; export const ngModelGroupExample = ` <form> <div ngModelGroup="person"> <input [(ngModel)]="person.name" name="firstName"> </div> </form>`; export const ngModelWithFormGroupExample = ` <div [formGroup]="myGroup"> <input formControlName="firstName"> <input [(ngModel)]="showMoreControls" [ngModelOptions]="{standalone: true}"> </div> `;