angular-form-model
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

angular-form-model

in your model, set any form control options. The state value of the form field upon running ToAngularForm will match values set in the model. Fields with unset values will have null values on the form.

example:

import {FormControlOptions} from 'angular-form-model/lib/decorators';

export class Book {

  @FormControlOptions({ updateOn: 'blur' })
  title = 'Wild Thornberries';

  author = 'Nigel Thornberry';

}

to create an angular dynamic form using our model

import {Book} from './book.model';
import {FormGroup} from '@angular/forms';
import {ToAngularForm} from 'angular-form-model';

class SomeComponent {

  someFunction() {

    // lets create a new form from our model
    const book: Book = new Book();
    const form: FormGroup = ToAngularForm(book);

  }

}

Package Sidebar

Install

npm i angular-form-model

Weekly Downloads

8

Version

0.1.0

License

MIT

Unpacked Size

9.5 kB

Total Files

10

Last publish

Collaborators

  • johnreubank