0

クリックすると非表示になる開始ボタンを取得し、停止ボタンを表示する方法。停止ボタンをクリックすると、開始ボタンが表示されます。これを試しましたが、そうではありません。誰かがアイデアを持っていますか?

'use strict';
angular.module('djoro.controllers')
.controller('WifiSmartConfigCtrl', function($scope, $window, $ionicPlatform){
  $scope.EventRunning = false;
  $scope.showAlert = function(){
    $ionicPlatform.ready(function(){
      $window.cordova.plugins.Smartconfig.alert('My plugin works !');
    });
  };
  $scope.startSmartconfig = function(){
    var onSuccess = function(success){
      $scope.StartEvent = function (event) {
        event.preventDefault();
        $scope.EventRunning = true;
      };
    };
    var onFail = function(){};
    $ionicPlatform.ready(function(){
      $window.cordova.plugins.Smartconfig.startSmartconfig(onSuccess, onFail, wifiPassword);
    });
  };
  $scope.stopSmartconfig = function(){
    $ionicPlatform.ready(function(){
      var onSuccess = function(){
        $scope.StopEvent = function (event) {
          event.preventDefault();
          $scope.EventRunning = true;
        };
        alert("stopSmartconfig done");
      };
      var onFail = function(){};
      $window.cordova.plugins.Smartconfig.stopSmartconfig(onSuccess, onFail);
    });
  };
)};
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>

<div class="startWifi">
                <button ng-hide="EventRunning" class="button button-full button-balanced" ng-click="startSmartconfig($event)">Start</button>
                <button ng-show="EventRunning" class="button button-full button-assertive" ng-click="stopSmartconfig($event)">Stop</button>
</div>

クリックすると非表示になる開始ボタンを取得し、停止ボタンを表示する方法。停止ボタンをクリックすると、開始ボタンが表示されます。これを試しましたが、そうではありません。誰かがアイデアを持っていますか?

4

2 に答える 2

0
'use strict';

angular.module('djoro.controllers')

 .controller('WifiSmartConfigCtrl', function($scope, $window,    $ionicPlatform){

 $scope.EventRunning = false;

  $scope.showAlert = function(){
 $ionicPlatform.ready(function(){
   $window.cordova.plugins.Smartconfig.alert('My plugin works !');
});
};

$scope.startSmartconfig = function(event){

    var onSuccess = function(success){
        $scope.StartEvent = function (event) {
        event.preventDefault();
        $scope.EventRunning = true;
        };

    };

    var onFail = function(){};

    $ionicPlatform.ready(function(){

    $window.cordova.plugins.Smartconfig.startSmartconfig(onSuccess, onFail, wifiPassword);

    });

 };

 $scope.stopSmartconfig = function(event){
    $ionicPlatform.ready(function(){



      var onSuccess = function(){

        $scope.StopEvent = function (event) {
        event.preventDefault();
        $scope.EventRunning = true;
    };

          alert("stopSmartconfig done");
      };
      var onFail = function(){};

      $window.cordova.plugins.Smartconfig.stopSmartconfig(onSuccess, onFail);
    });



     };

   )};

呼び出し元がパラメーターを保持し、メソッドにパラメーターを渡していないコントローラーメソッドは、上記のコードを参照してください

于 2015-09-22T12:31:54.553 に答える