danhunsaker / angular-dynamic-forms

Build Forms in AngularJS From Nothing But JSON (please see Alternatives in the README)
MIT License
379 stars 140 forks source link

No Documentation for Attributes / ID Attribute Not Supported #41

Open agatlin opened 9 years ago

agatlin commented 9 years ago

The documentation is pretty good, and I love the library, but there does not appear to be any example for how to add attributes. The documentation just says that you apply key:value pairs but does not provide an example of the syntax.

Could you please provide an example?

Also, it might be useful if developers could apply an ID directly to a particular item. It does not appear that ID is supported.

Thank you!

danhunsaker commented 9 years ago

ID is an attribute just like any other, so just drop it in the attributes option.

As for key-value pairs, maybe describing the option as an object would help...

[
  {
    "type": "textarea",
    "model": "example",
    "attributes": {
      "class": "example attributes",
      "id": "example-with-attributes"
    },
    "placeholder": "This is an example of using the 'attributes' option on a form element..."
  }
]