JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<div ng-app="app">
<div ng-controller="ctrl">
<textarea watcher ng-model="expression"></textarea>
</div>
</div>
JavaScript
var app = angular.module('app',
[
]);
app.directive('watcher', [function () {
return {
restrict: 'A',
link: function (scope, elem, attrs) {
scope.$watch(attrs.ngModel, function (v) {
if(v) {
console.log('I has value!');
} else {
console.log('I has no value :(');
}
});
}
}
}]);
app.controller('ctrl', ['$scope', function($scope) {
}]);