Jump to content

Angular - can't add variables


jazzyscript

Recommended Posts

I am trying to make a total that accumulates, like so:

 

$scope.total = 0;

...

$scope.total += $scope.amountIn;

 

But even when amountIn is a number, the values are concatenated. Yet if I try a multiplication operation like so:

 

$scope.total = 10 * $scope.amountIn;

 

It does the math! I've never had this problem with regular javascript. Help?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...