我對AngularJS有問題。在我的表單中,我有幾個輸入。我必須對數據做一些數學計算,然後保存它。但是因爲我使用Angularfire,我不得不將結果分配給ng模型,這就是我卡住的地方。我怎樣才能做到這一點?用數學設置Ng模型數據
這裏是我的代碼:
<label>First</label>
<input name="firstmatch" ng-model="project.firstmatch">
<label>Second</label>
<input name="secondmatch" ng-model="project.secondmatch">
<label>Third</label>
<input name="thirdmatch" ng-model="project.thirdmatch">
<label>Fourth</label>
<input name="fourth" ng-model="project.fourthmatch">
<label>Fifth</label>
<input name="fifthmatch" ng-model="project.fifthmatch">
<!-- The math part-->
<textarea name="points" ng-model="project.points"> {{ project.firstmatch--project.secondmatch--project.thirdmatch--project.fourthmatch--project.fifthmatch }} </textarea>
謝謝!
是的,數學部分看起來很瘋狂,但是輸出所需的數據。 –
你在哪裏分配 – Satpal
我嘗試了很多方法,這是一個: –