How to sum two scopes?

Hello guys, I got two scopes getting my json entry count, I log them on console to show the results,

I’ve put an if to comparem them, like this:

if ($scope.count == $scope.total)
{
 console.log('works!');
}

When both display the same value, I can’t get this if to work.

How can i do this?

Try JQuery - http://i.stack.imgur.com/ssRUr.gif

P.S. Sorry just joking. try console.log the values

2 Likes

I’d console.log and the sum is showing the correct value,

Why my comparison isn’t working then? :confounded:

Please create a plnrk to replicate your problem

before comparing two scope values please have a check whether both the values are numbers by angular.isNumber(value).both values must returns true .otherwise check your input values.

or compare using angular.equals($scope.count,$scope.total);

Thx guys, I just fixed it :smile: