I am trying to implement an AngularJS directive that would count the number of characters entered into a textarea and display it to the user. Note: it will actually become much more complex later on and will become a full-fledged component that will be similar to the js component used by Stack Overflow for user comments: users will be notified how many more characters they may or must enter with different font colors.Here is how the markup would look for the initial version:<div ng-app>    <div ng-controller=myController>       <cmp>         <enhanced-textarea ng-model=name></enhanced-textarea>         <h3>{{name}}</h3>         <notice></notice>                  <cmp>     </div></div>My js code is as follows:var myModule = angular.module('myModule', []);myModule.directive('cmp', function(){    return {        restrict: 'E',        controller: 'cmpCtrl',        replace: true,        transclude: true,        scope: {            name: '='        },        template: '<div ng-transclude></div>'    };}).controller('cmpCtrl', function ($scope, $element, $attrs) {   $scope.$parent.$watch('name', function(newVal){       if(newVal){            $scope.$parent.updatedSize = newVal.length;            console.log(newVal.length);         }   }, true);}).directive('enhancedTextarea', function () {    return {        restrict: 'E',        replace: true,        transclude: true,        template: '<textarea ng-transclude></textarea>'    };}).directive('notice', function () {    return {        restrict: 'E',        require: '^cmp',        replace: true,        scope: {            updatedSize: '='        },        template: '<div>{{size}}</div>',        link: function($scope, $element, $attrs, cmpCtrl){            console.log(cmpCtrl);            $scope.$parent.$watch('updatedSize', function(newVal){               if(newVal){                  $scope.size = newVal;               }           }, true);        }    };});function myController($scope) {    $scope.name = 'test';};I find it overly complex and I am sure it can be simplified.Can anyone please advise and help perhaps by providing alternatives together with explanations?Here is the fiddle
Simplifying an AngularJs directive that counts the number of characters entered in a textarea
javascript;html;angular.js