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

Commit f8e4e33

Browse files
committed
added support for textarea module
1 parent bd955d6 commit f8e4e33

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<div class="form-group">
2+
<label for="{{id}}">
3+
{{options.label || 'Text'}}
4+
{{options.required ? '*' : ''}}
5+
</label>
6+
<textarea type="text"
7+
class="form-control"
8+
id="{{id}}"
9+
rows="{{options.lines}}"
10+
placeholder="{{options.placeholder}}"
11+
ng-required="options.required"
12+
ng-disabled="options.disabled"
13+
ng-model="value">
14+
</textarea>
15+
</div>

src/directives/formly-field.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ angular.module('formly.render')
66
var templateUrl = '';
77

88
switch(type) {
9+
case 'textarea':
10+
templateUrl = 'directives/formly-field-textarea.html';
11+
break;
912
case 'radio':
1013
templateUrl = 'directives/formly-field-radio.html';
1114
break;

src/views/home.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ app.controller('home', function($scope, $parse, $rootScope) {
1111
}, {
1212
type: 'text',
1313
label: 'Last Name',
14-
placeholder: 'Doe',
15-
required: true
14+
placeholder: 'Doe'
15+
}, {
16+
type: 'textarea',
17+
label: 'Tell me about yourself',
18+
placeholder: 'I like puppies',
19+
lines: 4
1620
}, {
1721
type: 'radio',
1822
label: 'Have you tried EmberJs yet?',
@@ -83,8 +87,7 @@ app.controller('home', function($scope, $parse, $rootScope) {
8387
label: 'Password'
8488
}, {
8589
type: 'checkbox',
86-
label: 'Check this here',
87-
required: true
90+
label: 'Check this here'
8891
}, {
8992
type: 'hidden',
9093
default: 'secret_code'

0 commit comments

Comments
 (0)