Last active
May 21, 2018 12:28
-
-
Save realtomaszkula/dc14f58608244cc21d425d90e0f3ef02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from '@angular/core'; | |
| type Label<T extends object> = { [key in keyof T]: string }; | |
| interface LoginForm { | |
| username: string; | |
| password: string; | |
| } | |
| @Component({ | |
| selector: 'app-form', | |
| template: ` | |
| <form> | |
| <input [(ngModel)]="login.username" name="username" [placeholder]="placeholders.username" /> | |
| <input [(ngModel)]="login.password" name="password" [placeholder]="placeholders.password" /> | |
| </form> | |
| ` | |
| }) | |
| export class FormComponent { | |
| login: LoginForm = { | |
| username: '', | |
| password: '' | |
| }; | |
| placeholders: Label<LoginForm> = { | |
| username: 'Username', | |
| password: 'Password' | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment