Created
June 8, 2016 01:25
-
-
Save shawnparrotte/12ac358a476d7b385203744509a637dd to your computer and use it in GitHub Desktop.
testing gist embed
This file contains 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"; | |
import { bootstrap } from "@angular/platform-browser-dynamic"; | |
import { FORM_DIRECTIVES, FormBuilder, ControlGroup } from "@angular/common"; | |
@Component({ | |
selector: 'app', | |
directives: [FORM_DIRECTIVES], | |
template:` | |
<form [ngFormModel]="myForm" | |
(ngSubmit)="onSubmit(myForm.value)"> | |
<input type="text" id="skuItems" [ngFormControl]="myForm.controls['sku']" placeholder="SKU" /> | |
<button type="submit">I'm a button</button> | |
</form> | |
` | |
}) | |
class App { | |
myForm: ControlGroup; | |
constructor(fb: FormBuilder){ | |
this.myForm = fb.group({ | |
'sku': ['ABC123'] | |
}); | |
} | |
onSubmit(value: string): void { | |
console.log(value); | |
} | |
} | |
bootstrap(App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment