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

Commit 718c172

Browse files
author
Kamil Kisiela
committed
feat(): templateOptions.className
equivalent to ng-class on ng-model. It can be string, array or just an expression
1 parent 72a94bd commit 718c172

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/runs/class-name.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { ngModelAttrsTransformer } from './../helpers/index.js';
2+
3+
export default (formlyConfigProvider) => {
4+
// add only step attribute because min and max are both built-in
5+
formlyConfigProvider.extras.fieldTransform.push((fields) => {
6+
return ngModelAttrsTransformer(fields, (field) => (
7+
field.templateOptions && typeof field.templateOptions.className !== 'undefined'
8+
), 'className', {
9+
bound: 'ng-class'
10+
});
11+
});
12+
};

src/runs/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import className from './class-name';
12
import theme from './theme';
23

3-
export default [theme];
4+
export default [className, theme];

0 commit comments

Comments
 (0)