Organizational Research By

Surprising Reserch Topic

angular scope watch newval oldval


angular scope watch newval oldval  using -'javascript,angularjs'

I've been working on an angular project I inherited and I can't contact the original author. There is this watch expression I'm not sure of and I was wondering if someone could help me understand the code:

$scope.$watch(calculator.value, function(newVal, oldVal) {
    if(newVal !== oldVal) {
        i = newVal;
        updateCalculation();
    }
});


What confuses me is this line of code: newVal !== oldVal. Any idea why one would need such a check?
    
asked Oct 13, 2015 by gauravsinghal83
0 votes
2 views



Related Hot Questions



Government Jobs Opening


...