mysql - Perform angularjs operation inside value attribute of html input tag -


i want perform operation value attribute not working

<input name="grand_total" type="text" class="form-control" value="@{{sum(saletemp)*discount1/100 | currency: "&#x9f3"}}" />  <input name="discount" type="text" class="form-control" id="add_payment"  ng-model="discount1"/> 

second question if want send value p tag after html form submission, how can , how can retrieve value? want pass value @{{sum(saletemp)*discount1/100 | currency: "&#x9f3"}} controller , want store database. here code portion

<div class="form-group">      <label for="grand_total" class="col-sm-4 control-label">discount</label>      <div class="col-sm-8">            <p class="form-control-static" ><b>@{{sum(saletemp)*discount1/100 | currency: "&#x9f3"}}</b></p>       </div> </div> 

you should use ng-model instead of dealing value attribute of input tag... provide more flexibility doing kind of operation on , accessing in controller..

like ng-model="saletemp" available in controller $scope.saletemp.. , if want call functions on change in input tag value, can call ng-change="functionname()" have defined in controller as

 $scope.functionname = function(){your function definition} 

here fiddle allow put currency in input tag when ng-model used. http://jsfiddle.net/arunpjohny/wnban/


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -