Angular + 按下按钮时流星计数器增加
Angular + meteor counter increment when button is pressed
我在我的项目中使用 meteor、angular 和 ionic。当按下模态中的某个按钮时,我想增加一个计数器。然后我想显示这个计数器的值。
我的代码如下,但它似乎根本不起作用:
Html
<button class="button button-clear button-positive" ng-click="timee(1)">
Delay
</button>
控制器
angular
.module('Buschat')
.controller('NewGoodCtrl', NewGoodCtrl);
function NewGoodCtrl($scope, $state, $meteor) {
$scope.timecnt=0;
$scope.hideModal = hideModal;
$scope.timee = timee;
function hideModal() {
$scope.modal.hide();
}
function timee(inc){
$scope.timecnt += inc;
$scope.modal.hide();
}
只是提一下,当删除行 $scope.timecnt += inc;
时,隐藏模式功能完美运行
尝试将您的函数放入 $scope 变量中,然后从 html 文件中调用它
我在我的项目中使用 meteor、angular 和 ionic。当按下模态中的某个按钮时,我想增加一个计数器。然后我想显示这个计数器的值。 我的代码如下,但它似乎根本不起作用:
Html
<button class="button button-clear button-positive" ng-click="timee(1)">
Delay
</button>
控制器
angular
.module('Buschat')
.controller('NewGoodCtrl', NewGoodCtrl);
function NewGoodCtrl($scope, $state, $meteor) {
$scope.timecnt=0;
$scope.hideModal = hideModal;
$scope.timee = timee;
function hideModal() {
$scope.modal.hide();
}
function timee(inc){
$scope.timecnt += inc;
$scope.modal.hide();
}
只是提一下,当删除行 $scope.timecnt += inc;
时,隐藏模式功能完美运行
尝试将您的函数放入 $scope 变量中,然后从 html 文件中调用它