Skip to content

Instantly share code, notes, and snippets.

@pankajparkar
Created August 4, 2018 05:40
Show Gist options
  • Save pankajparkar/ec6efc18805220dc4ab984357d0ef1c3 to your computer and use it in GitHub Desktop.
Save pankajparkar/ec6efc18805220dc4ab984357d0ef1c3 to your computer and use it in GitHub Desktop.
Helper at the time of demo
<ng-template #form>
<form novalidate>
<label>
First Name
<input name="firstName" />
<!-- <span>This field is required</span> -->
</label>
<label>
Last Name
<input name="lastName" />
<!-- <span>This field is required</span> -->
</label>
<label>
Age
<input name="age" />
<!-- <span>This field is required</span> -->
</label>
<label>
Hobbies
<input [(ngModel)]="newHobby" [ngModelOptions]="{standalone: true}" placeholder="Add new hobby ..." />
<button type="button" (click)="addHobby()">+</button>
<hr />
<ul *ngFor="let hobby of userForm.controls.hobbies.value">
<li>{{hobby}}</li>
</ul>
</label>
</form>
</ng-template>
<ng-template #info>
<div>First Name: {{user.firstName}}</div>
<div>Last Name: {{user.lastName}}</div>
<div>Age: {{user.age}}</div>
<div>
Hobbies:
<ul *ngFor="let hobby of user.hobbies">
<li>{{hobby}}</li>
</ul>
</div>
</ng-template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment