JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js"></script>
<div ng-app="app" ng-controller="Controller">
<textarea ng-model="textValue"></textarea>
</div>
JavaScript
var module = angular.module("app",[]);
module.directive("ngModel",function(){
return {
restrict: 'A',
priority: -1, // give it lower priority than built-in ng-model
link: function(scope, element, attr) {
scope.$watch(attr.ngModel,function(value){
if (value){
element[0].onchange();
// element.trigger("change");
}
});
}
}
});
module.controller("Controller", function ($scope) {
$scope.textValue = "Test";
window.setInterval(function () {
$scope.textValue = $scope.textValue === "Test" ? "Hello World" : "Test";
$scope.$apply();
},2000);
});
document.querySelector("textarea").onchange = function () {
console.log("changed");
};