import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
import {FormatService} from '@eg/core/format.service';
import {FmRecordEditorComponent} from '@eg/share/fm-editor/fm-editor.component';
+import {FormGroup, FormControl} from '@angular/forms';
@Component({
templateUrl: 'sandbox.component.html'
dynamicTitleText: string;
+ badOrgForm: FormGroup;
+
complimentEvergreen: (rows: IdlObject[]) => void;
notOneSelectedRow: (rows: IdlObject[]) => boolean;
}
ngOnInit() {
+ this.badOrgForm = new FormGroup({
+ 'badOrgSelector': new FormControl(
+ {'id': 4, 'includeAncestors': false, 'includeDescendants': true}, (c: FormControl) => {
+ // An Angular custom validator
+ if (c.value.orgIds && c.value.orgIds.length > 5) {
+ return { tooMany: 'That\'s too many bad libraries!' };
+ } else {
+ return null;
+ }
+ } )
+ });
+
+ this.badOrgForm.get('badOrgSelector').valueChanges.subscribe(bad => {
+ this.toast.danger('The worst libraries are: ' + JSON.stringify(bad.orgIds));
+ });
this.gridDataSource.data = [
{name: 'Jane', state: 'AZ'},
this.sbChannel.postMessage({msg : $event.target.value});
}
+ // Example of click handler for row action
+ complimentEvergreen2(rows: IdlObject[]) {
+ alert('I know, right?');
+ }
+
openEditor() {
- this.fmRecordEditor.open({size: 'lg'}).then(
- ok => { console.debug(ok); },
- err => {
- if (err && err.dismissed) {
- console.debug('dialog was dismissed');
- } else {
- console.error(err);
- }
- }
+ this.fmRecordEditor.open({size: 'lg'}).subscribe(
+ pcrudResult => console.debug('Record editor performed action'),
+ err => console.error(err),
+ () => console.debug('Dialog closed')
);
}