Good morning, I have the following code
Angular
var aplicacion = angular.module('app',[])
aplicacion.factory('datosCompartidos', function (){
var datosCompartidos = {}
datosCompartidos.contador = 0
datosCompartidos.getContador = function(){
return datosCompartidos.contador
}
setInterval(function check(){
datosCompartidos.contador +=1
console.log(datosCompartidos.contador)
}, 1000);//cada 1 minuto
return datosCompartidos
})
aplicacion.controller('profile',['$scope','datosCompartidos',function($scope,datosCompartidos){
$scope.m = datosCompartidos.contador
}])
HTML
<div ng-app="app">
<div ng-controller="profile">
{{m}}
</div>
</div>
My problem is that the value of m in the $ scope is not updated, as I should do, I should add some $ watcher