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

Commit fc1043e

Browse files
author
Kamil Kisiela
committed
feat(textarea): grow options
equivalent to md-no-autogrow. When present, textareas will not grow automatically.
1 parent 6ee80f0 commit fc1043e

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/runs/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import mdThemeManipulator from './md-theme-manipulator';
2+
import mdNoAutogrow from './md-no-autogrow';
23

3-
export default [mdThemeManipulator];
4+
export default [mdThemeManipulator, mdNoAutogrow];

src/runs/md-no-autogrow.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {ngModelAttrsManipulator} from './../helpers/index.js';
2+
3+
export default (formlyConfigProvider) => {
4+
formlyConfigProvider.templateManipulators.preWrapper.push((template, options) => {
5+
if (!angular.isDefined(options.templateOptions.grow)) {
6+
return template;
7+
}
8+
if(options.templateOptions.grow !== false) {
9+
return template;
10+
}
11+
if (!angular.isDefined(options.type) || options.type !== 'textarea') {
12+
return template;
13+
}
14+
15+
return ngModelAttrsManipulator(template, options, 'md-no-autogrow');
16+
});
17+
}

0 commit comments

Comments
 (0)