2014-12-17 3 views
0

단추 아이콘, thext를 변경하려고하는데 onClick()을 사용하지 않으려합니다.클릭시 변경 단추()

Unfortunateley 내가 처음 클릭 할 때 텍스트가 변경되고 다시 클릭하면 아이콘이 변경되지만 텍스트는 변경되지 않습니다.

스택에서 클릭 이벤트 후에 바우처가 올바르게 설정됩니다. 정말 두려워하는 이유와 왜 두 번 클릭하면 변경되는지 알지 못합니다. 내 컨트롤러 그게 전부

<ion-view title="Who-U"> 
    <ion-content class="padding"> 

     <a class="item item-thumbnail-left" href="#"> 
      <img src="img/cover.png"> 
      <h2>{{username}}</h2> 
      <p>Points: {{points}}</p> 
     </a> 

     <button ng-click="click()" class="button button-full button-positive" ng-disabled="{{buttonDisable}}"> 
      <i class='{{buttonType}}'></i>{{text}} 
     </button> 
    </ion-content> 
</ion-view> 

: 여기

내 HTML입니다

angular.module('home', ['services']) 

.controller('homeCtrl', 
    function ($scope, $location, $state, localStorageService, serverAPI, $ionicPopup) { 

     $scope.buttonType = "icon ion-search", 
     $scope.buttonDisable = false, 
     $scope.text = 'Search', 


     $scope.click = function() { 
      $scope.buttonDisable = true 
      $scope.text = 'Searching' 
      $scope.buttonType = "icon ion-loading-a" 

     }; 

    }) 
당신은 넣어 잊지

답변

2

';' 코드에서 : P

하면이 시도 :

$scope.buttonType = "icon ion-search"; 
    $scope.buttonDisable = false; 
    $scope.text = 'Search'; 


    $scope.click = function() { 
     $scope.buttonDisable = true; 
     $scope.text = 'Searching'; 
     $scope.buttonType = "icon ion-loading-a"; 
}