JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-controller="Controller">
myValue: <span ng-bind="myValue"></span>
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('Controller', function ($scope, $interval, $timeout) {
$scope.myValue = "first";
console.log($scope.myValue);
$timeout(function() {
$scope.myValue = "second"; // never updates
console.log($scope.myValue);
$scope.$emit("my-event", "third"); // never updates
console.log($scope.myValue);
$interval(function() {
$scope.$emit('my-event', "fourth");
}, 1000, 1);
}, 1000);
$interval(function() {
$scope.myValue = "fifth";
console.log($scope.myValue);
$interval(function() {
$scope.$emit("my-event", "sixth");
}, 1000, 1);
}, 3000, 1);
$scope.$on('my-event', function (event, arg) {
$scope.myValue = arg;
console.log(arg);
});
});