【问题标题】:Angular + meteor counter increment when button is pressed按下按钮时角+流星计数器增量
【发布时间】:2016-02-29 11:38:38
【问题描述】:

我在我的项目中使用流星、角度和离子。当按下模态中的某个按钮时,我想增加一个计数器。然后我想显示这个计数器的值。 我的代码如下,但它似乎根本不起作用:

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; 行被删除时,隐藏模式功能完美运行

【问题讨论】:

    标签: javascript angularjs meteor counter increment


    【解决方案1】:

    尝试将你的函数放在 $scope 变量中,然后从 html 文件中调用它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-10
      相关资源
      最近更新 更多