Skip to content

Latest commit

 

History

History
84 lines (47 loc) · 1.54 KB

File metadata and controls

84 lines (47 loc) · 1.54 KB

autoFormly

AngularJS service.

File: lib/client/auto-formly.js

autoFormly.collection(collection, fields)

Parse Mongo.Collection to get array with fields

Arguments

  • collection {CollectionCollection|AngularMeteorCollection}

Mongo Collection used directly or with $meteor AngularJS service

  • options {array|object|undefined}

Optional filtering fields using array with collection's keys or options object.

  • options.all {boolean}

Show all fields when true. Otherwise only these defined (see below)

  • options.fields {object}

Object with the field's key as property and formly field configuration (extends the auto-generated configuration). Instead of using formly configuration you can set field as visible or not using boolean value (true visible, false not used)

Returns {Array}

Array with fields to use in formly-form.

autoFormly.schema(schema, options)

Parse SimpleSchema object to get array with fields

Arguments

  • schema {SimpleSchema}

SimpleSchema instance

  • options {array|object|undefined}

See collection()

Returns {Array}

Array with fields to use in formly-form.

autoFormly.errors(collection, fields)

Gets errors of fields and sets them in form controls. Use it when insertion or collection update fails.

See example in readme.

Arguments

  • collection {SimpleSchema}

SimpleSchema instance

  • fields {array}

Array with fields