I am new to Angular. Not sure why directive is not working below. Searched some articles. Nothing helps
angular.module('oneApp', []).controller('OneAppController', function($scope){ //Some Logic }).directive('dvReplaceText', ['$interval', '$compile', function($interval, $compile) { return { restrict: 'A', link: function(scope, element, attr) { scope.$watch(scope.data, function(value) { element.html(value); }); } } }]); HTML:
<body ng-app="oneApp"> <div ng-controller="OneAppController"> <input class="input-data-box" ng-model="data" dv-replace-text=""/> </div> </body>
<input>element, and then are trying to change thehtmlof the element, but<input>doesn't have anhtmlproperty.