A promise is one deferred value. It will not be allowed more than once.
If you need similar functionality for event streams, select Rx.JS
With Rx, your code would look something like this:
var app = angular.module('plunker', []); app.controller('MainCtrl', function($scope, myService) { myService.subscribe(function(result) { $scope.i = result; }); }); app.factory('myService', function($interval, $q) { var subject = new Rx.Subject(); var i = 0; $interval(function() { i += 1; subject.onNext(i); }, 2000); return subject; });
source share