1
Does anyone have any idea why mine doesn’t work $scope.$watch
, that model $scope.paciente.telefones
is connected to a combobox.
$scope.$watch('paciente.telefones', function(oldv, newv) {
var existeCelularComEnvioSms = false;
angular.forEach($scope.paciente.telefones, function(tel) {
if (tel.envioSms == true) {
existeCelularComEnvioSms = true;
} else if(existeCelularComEnvioSms == true) {
tel.envioSms = false;
}
});
});
Leonardo, why isn’t it working? Error returns, or something like that? Please add this information to the question.
– Molx
only one observation, the parameters are reversed, the correct is: newv, oldv
– Ivan Ferrer