Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save realtomaszkula/dc14f58608244cc21d425d90e0f3ef02 to your computer and use it in GitHub Desktop.
Save realtomaszkula/dc14f58608244cc21d425d90e0f3ef02 to your computer and use it in GitHub Desktop.
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