JSFiddle - React, Tailwind, and code Playground
by terebentina
HTML
<div ng-app="test" ng-controller="MyCtrl">
{{date|date:'fullDate'}}
<br>
<a href="" ng-click="changeDate()">change date</a>
|
<a href="" ng-click="changeText()">change text</a>
<div id="log"></div>
</div>
JavaScript
angular.module('test', []).controller('MyCtrl', ['$scope', function($scope) {
$scope.date = new Date();
$scope.text = 'bla';
$scope.$watch('date', function() {
document.getElementById('log').textContent += 'date changed ';
});
$scope.$watch('text', function() {
document.getElementById('log').textContent += 'text changed ';
});
$scope.changeDate = function() {
$scope.date.setDate($scope.date.getDate() + 1);
}
$scope.changeText = function() {
$scope.text = Math.random();
}
}]);