Files
angulardynformmodule/src/app/app.component.ts
2017-05-30 07:37:33 +02:00

58 lines
1.3 KiB
TypeScript

import {Component} from '@angular/core';
import {QuestionInterface} from './modules/dyn-form/types/question.interface';
@Component({
selector: 'my-app',
templateUrl: './app.component.html'
})
export class AppComponent {
public formQuestions: QuestionInterface[] = [
{
type: 'flag',
description: 'This is a help tooltip',
properties: {
key: 'flags',
label: 'Form Type Flags',
order: 1,
// dropdown && flags
options: [{key: 'alpha', value: 'A'}, {key: 'beta', value: 'B'}, {key: 'gamma', value: 'C'}, {key: 'delta', value: 'D'}]
}, constraints: {
optional: true
}
}, {
type: 'dropdown',
description: 'Cool dropdown',
properties: {
key: 'cooldrop',
label: 'Dropdown',
order: 2,
methods: ['insert'],
// dropdown
options: [{key: 'hello', value: 'Hallo'}, {key: 'world', value: 'World'}, {key: 'and', value: 'And'}, {key: 'u', value: 'You'}]
}, constraints: {
optional: false
}
}, {
type: 'hidden',
description: 'ID',
properties: {
key: 'ID',
order: 3
}, constraints: {
optional: false
}
}
];
public formValue = {
flags: {gamma: true},
ID: 5,
cooldrop: 'u'
};
submit(value: any) {
console.log('send', value);
}
}