Skip to content
This repository has been archived by the owner on Jan 22, 2018. It is now read-only.

Commit

Permalink
feat(): templateOptions.className
Browse files Browse the repository at this point in the history
equivalent to ng-class on ng-model.

It can be string, array or just an expression
  • Loading branch information
Kamil Kisiela committed Jan 12, 2016
1 parent 72a94bd commit 718c172
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/runs/class-name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ngModelAttrsTransformer } from './../helpers/index.js';

export default (formlyConfigProvider) => {
// add only step attribute because min and max are both built-in
formlyConfigProvider.extras.fieldTransform.push((fields) => {
return ngModelAttrsTransformer(fields, (field) => (
field.templateOptions && typeof field.templateOptions.className !== 'undefined'
), 'className', {
bound: 'ng-class'
});
});
};
3 changes: 2 additions & 1 deletion src/runs/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import className from './class-name';
import theme from './theme';

export default [theme];
export default [className, theme];

0 comments on commit 718c172

Please sign in to comment.