I have encountered a strange issue that I've never seen before. When I try to input the value of scope
upon clicking on <a>
, everything works fine. However, if I have entered values in other inputs and then click on <a>
again, the values in the rest of the inputs get cleared. Can anyone offer advice on why this might be happening?
file.html
<input ng-disabled="product.disabled" type="text" ng-model="product.productData.oldPrice" name="oldPrice" class="form-control" ng-pattern="/^[0-9]*$/" required>
<input ng-disabled="product.disabled" type="text" ng-model="product.productData.newPrice" name="newPrice" class="form-control" ng-pattern="/^[0-9]*$/" required>
<input ng-disabled="product.disabled" type="text" name="level" class="form-control" ng-model="product.productData.level" required>
<div class="input-group-addon level-add">
<a ng-click="product.easyLevel()" class="add-field add-field-easy">
<i class="fa fa-battery-quarter"></i>
</a>
</div>
controller.js
app.easyLevel = function(){
app.productData = {
level: 'fa fa-3x fa-battery-quarter text-primary level-higher-easy'
}
}
services
userFactory.createNewCourse = function(productData){
return $http.post('/api/courses', productData)
}
Variables: app = this
, product
is controller as.
Issue: After filling the first two inputs and clicking product.easyLevel()
to enter
'fa fa-3x fa-battery-quarter text-primary level-higher-easy'
into the third input, the values in the above inputs are being erased.