Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-formly

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-formly

> JavaScript Powered Forms for Ember.js

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27
increased by80%
Maintainers
1
Weekly downloads
 
Created
Source

Ember-formly

JavaScript Powered Forms for Ember.js

NPM

Download count all time Ember Observer Score Build Status PRs Welcome

ember-formly is an Ember.js addon based on angular-formly

The aim isn't to fully duplicate angular-formly's functionality, but instead to propose a new & simplified mechanism for automating form creation by using patterns like components (instead of custom directives) while keeping some key concepts like model and fields.

Installation

ember install ember-formly

Example

http://g.recordit.co/8cn0KyxHYO.gif

Route/Component/Controller:

  model() {
    return {
      age: 20,
      veggie: true,
      favcolor: '#0000ff',
      borndate: '1986-11-14'
    }
  },
  fields: computed(function() {
    return [
      {
        key: 'age',
        component: 'custom-fields/html-input',
        options: {
          type: 'number',
          label: 'Age'
        }
      },
      {
        key: 'veggie',
        component: 'custom-fields/html-input',
        options: {
          type: 'checkbox',
          label: 'Is a Veggie?'
        }
      },
      {
        key: 'favcolor',
        component: 'custom-fields/html-input',
        options: {
          type: 'color',
          label: 'Favorite Color'
        }
      },
      {
        key: 'borndate',
        component: 'custom-fields/date-picker',
        options: {
          label: 'Born Date'
        }
      }
    ]
  })

Basic Template

{{ember-formly fields=fields model=model}}

fieldClassName

Apply a class to each field:

{{ember-formly fields=fields model=model fieldClassName="foobar"}}

Block

Use custom markup for each field:

{{#ember-formly fields=fields as |field|}}
  <div class="baz-wrapper">
    {{ember-formly-field
      field=field
      model=model.nested
      onchange=(action 'foobar')}}
  </div>
{{/ember-formly}}

Advanced Usage

Callback actions

const fields = [
  {
    key: 'date',
    component: 'date-picker',
    options: {
      label: 'Pick a date!',
      callback: function(value) {
        window.alert('Selected date: ' + value);
      }
    }
  }
];

date-picker.js:

  {{pikaday-input
    value=value
    onSelection=(action options.callback)}}

Development

Installation

  • git clone this repository
  • npm install
  • bower install

Running

Running Tests

  • npm test (Runs ember try:testall to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://ember-cli.com/.

Keywords

FAQs

Package last updated on 27 Sep 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc