-
Notifications
You must be signed in to change notification settings - Fork 32
/
demo-form.component.html
46 lines (38 loc) · 1.46 KB
/
demo-form.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<h2>Integration with forms (<code>ngModel</code>)</h2>
<form (ngSubmit)="onSubmit()" #demoForm="ngForm">
<h3>User profile form</h3>
<div>
<label for="name">Name</label>
<input [(ngModel)]="model.name" type="text" name="name" id="name">
</div>
<div>
<label for="surname">Surname</label>
<input [(ngModel)]="model.surname" type="text" name="surname" id="surname">
</div>
<label for="description">Description</label>
<!-- Remember to add the license key to the CKEditor 4 configuration:
https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-licenseKey -->
<ckeditor
[(ngModel)]="model.description"
id="description"
name="description"
[config]="{ extraPlugins: 'divarea' }">
</ckeditor>
<p *ngIf="description && description.dirty" class="alert">Description is "dirty".</p>
<p *ngIf="description && description.touched" class="alert">Description has been "touched".</p>
<p>
<button type="reset" (click)="reset()">Reset form</button>
</p>
<p>
<button type="submit">Submit this form</button>
<em>(Open the console first)</em></p>
</form>
<h3>Editor data preview (read only)</h3>
<p>
Note that it's only a prove of concept of using the `ngModel`.
It allows editing, but the editor instantly strips out unknown tags and autoparagraphs text outside of block
elements.
</p>
<textarea readonly="true" [ngModel]="model.description" style="width: 100%; height: 40px"></textarea>
<h3>Form data preview</h3>
<pre>{{ formDataPreview }}</pre>