JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app="myApp" ng-controller="myCtrl">
<button ng-click=update()>Update</button>
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope,$window) {
console.log("in controller ",window.test);
$scope.update = function () {
$window.test="new";
};
$scope.$watch(function () {
return $window.test
}, function(n,o){
console.log("changed ",n);
});
})