Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 986fc13

Browse files
author
Nick Litwin
committed
Add directive for textarea with label and count
1 parent 1fb9b6f commit 986fc13

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(function() {
2+
'use strict';
3+
4+
angular.module('tcUIComponents').directive('tcTextarea', tcTextarea);
5+
6+
function tcTextarea() {
7+
return {
8+
restrict: 'E',
9+
templateUrl: 'directives/tc-textarea/tc-textarea.html',
10+
scope: {
11+
labelText: '@',
12+
placeholder: '@',
13+
characterCount: '=',
14+
characterCountMax: '@',
15+
commentValue: '='
16+
},
17+
link: function(scope) {
18+
console.log(scope);
19+
}
20+
}
21+
}
22+
})();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
label.tc-textarea__label {{labelText}}
2+
span.tc-textarea__char-count(ng-if="characterCount")
3+
span.tc-textarea__char-count--current {{commentValue.length || 0}}
4+
5+
span {{' / ' + characterCountMax}}
6+
7+
textarea(placeholder="{{placeholder}}", ng-model="commentValue", maxlength="{{characterCountMax}}")

0 commit comments

Comments
 (0)