Created
May 4, 2015 03:46
-
-
Save corburn/de4c5c05bcfd3a622e69 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 {bootstrap, Component, Decorator, View, If, For, EventEmitter} from 'angular2/angular2'; | |
import {FormBuilder, Validators, FormDirectives, ControlGroup} from 'angular2/forms'; | |
@Component({ | |
selector: 'app', | |
injectables: [FormBuilder] | |
}) | |
@View({ | |
template: ` | |
<div [control-group]="form" class="form-group" | |
[class.has-success="form.controls.name.valid"] | |
[class.has-error="! form.controls.name.valid"] | |
> | |
<input control="name" class="form-control"> | |
{{ form.controls.name.value }} | |
</div> | |
`, | |
directives: [FormBuilder] | |
}) | |
class AppComponent { | |
form: ContolGroup; | |
builder: FormBuilder) { | |
this.builder = b; | |
this.form = b.Group({ | |
name: ["", Validators.required] | |
}) | |
} | |
} | |
export function main() { | |
bootstrap(AppComponent); | |
} |
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
<!doctype html> | |
<html> | |
<title>Survey Builder</title> | |
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstra,/3.3.4/css/bootstrap" charset="utf-8"> | |
<script src="https://cdn.firebase.com/js/client/2.2.3/firebase.js"</script> | |
<body> | |
<app> | |
Loading... | |
</app> | |
$SCRIPTS$ | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment