【发布时间】:2017-09-01 12:10:20
【问题描述】:
我正在尝试在我的应用程序中添加两个数字。一个数字来自数据库,另一个我想插入到应用程序中。这很简单,但我是 angularjs 的新手。这是我的代码:
HTML:
<div class="item-input-inset">
<label class="item-input-wrapper">
<input type="number" placeholder="Insert Points" ng-model="inp"/>
</label>
</div>
<span> {{sum()}} </span>app.js
app.js
.controller('AppCtrl', function($scope, PointService) {
$scope.points = 0;
$scope.inp = 0;
$scope.sum = function(){
return $scope.points + $scope.inp }
所有应用程序显示的数字都是 9,即 $scope.points,因为在我的数据库中它是 9,但是当我尝试输入任何数字时它不会添加输入数字。有人可以帮忙吗?
【问题讨论】:
标签: javascript angularjs ionic-framework backand