Skip to content

Instantly share code, notes, and snippets.

@shawnparrotte
Created June 8, 2016 01:25
Show Gist options
  • Save shawnparrotte/12ac358a476d7b385203744509a637dd to your computer and use it in GitHub Desktop.
Save shawnparrotte/12ac358a476d7b385203744509a637dd to your computer and use it in GitHub Desktop.
testing gist embed
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