I am brand new to the world of AngularJS and I am struggling with a specific calculation. I have created a form where users can enter a volume number, which will be used in a calculation to populate a field in my MongoDB document. However, I am having issues with this calculation as it always seems to insert the original product volume instead of the calculated one.
While I have no problem populating the types and tags array for my MongoDB document, I am facing challenges with the volume calculation.
$scope.product = {
types: [],
tags: []
};
Within the form group is where I retrieve the product volume:
.form-group
label.col-sm-3.control-label Volume
.col-sm-4
input.form-control(
ng-model='product.volume',
type='number',
placeholder='Volume')
My submit button triggers the creation of a new product document for MongoDB and initiates the calculation process:
var product = new Product($scope.product);
var capacity = 100
$scope.product.volume = (capacity / $scope.product.volume);
Once the MongoDB document setup is complete, I save it:
product.$save(function ()...
What could potentially be causing this issue?