Skip to content

Instantly share code, notes, and snippets.

@orlaqp
Created August 25, 2016 14:18
Show Gist options
  • Save orlaqp/893c13f26c2c53644f6daefadbfcd4bc to your computer and use it in GitHub Desktop.
Save orlaqp/893c13f26c2c53644f6daefadbfcd4bc to your computer and use it in GitHub Desktop.
// Component
import { Component, OnInit } from '@angular/core';
import { REACTIVE_FORM_DIRECTIVES, FormGroup } from '@angular/forms';
import { MATERIAL_FORM } from '../../../../../dist/ng2-materialform';
@Component({
selector: 'demo-checkbox',
directives: [MATERIAL_FORM, REACTIVE_FORM_DIRECTIVES, FormGroup],
template: require('./checkbox.html'),
})
export class DemoCheckboxComponent implements OnInit {
public fg: FormGroup;
constructor() {
this.fg = new FormGroup({});
}
ngOnInit() { }
}
// View
<form [formGroup]="fg" #f="ngForm">
<checkbox [fgd]="f" field="toggle1" label="Simple Checkbox"></checkbox>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment