Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

feat(wrapper): Compability of horizontal form #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ NOTE: All of these properties will be under the `templateOptions` property as of
###### Default
>`undefined`

---
##### labelClass (string)
>`labelClass` is used to add classes to labels.

###### Default
>`undefined`

---
##### fieldDivClass (string)
>`fieldDivClass` is used to add classes to the parent div element of the field.

###### Default
>`undefined`

---
##### addonLeft (object)
>`addonLeft` is used to add an add-on on the left of a field. The object accepts three properties: `text` that sets a simple text, `onClick` will add a `cursor:pointer` and an ng-click to the addon (invoked with the options and scope), and `class` that sets classes to the add-on.
Expand Down Expand Up @@ -324,3 +338,4 @@ Please see the [CONTRIBUTING Guidelines](CONTRIBUTING.md).

A special thanks to [Nimbly](http://gonimbly.com) for creating/sponsoring angular-formly's development.
Thanks to [Kent C. Dodds](https://github.com/kentcdodds) for his continued support on the project.

2 changes: 2 additions & 0 deletions src/wrappers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ export default ngModule => {
apiCheck: check => ({
templateOptions: {
label: check.string.optional,
labelClass: check.string.optional,
required: check.bool.optional,
labelSrOnly: check.bool.optional,
fieldDivClass: check.string.optional
}
})
},
Expand Down
7 changes: 5 additions & 2 deletions src/wrappers/label.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div>
<label for="{{id}}" class="control-label {{to.labelSrOnly ? 'sr-only' : ''}}" ng-if="to.label">
<label for="{{id}}" class="control-label {{to.labelSrOnly ? 'sr-only' : ''}} {{to.labelClass || ''}}" ng-if="to.label">
{{to.label}}
{{to.required ? '*' : ''}}
</label>
<formly-transclude></formly-transclude>
<div class="{{to.fieldDivClass || ''}}">
<formly-transclude></formly-transclude>
</div>
</div>