Ashok
Ashok

Reputation: 184

button ng-click is not working in ionic

ng-click is not working in ionic button, it's saying that in console as below

VM67 index.html:1 Uncaught ReferenceError: zPLysearch() is not defined

I've been trying to fix this problem for 2 hours I did't get any luck. Here my code,

<div class="col-90" >
  <button ng-click="zPLysearch()" class="button button-delete">zPLY search</button>
</div> 

but same function using like as below It's working fine

<div class="homecard wired" ng-show="show2" ng-click="zPLYsearch()">
</div>

Here My full html code

<ion-view title="zPLY Conf Tool"> 
  <ion-content padding="true" class="content_background">
      <div class=" homecard wired" ng-show="show2" ng-click="zPLYsearch()">
     </div>
      <div class="col-90" >
      <button ng-click="zPLysearch()" class="button button-delete">zPLY search</button>
    </div> 
  </ion-content>
</ion-view>

controller Code:

angular.module('wiredzplydetailscontroller', [])
  .controller('wiredzplydetailsCtrl', function($scope,$rootScope,$http,$ionicModal,$ionicPlatform, $ionicLoading,$ionicPopup, $timeout, $location) {

$scope.zPLYsearch=function(){ 

}


});

Upvotes: 0

Views: 342

Answers (2)

Nabeel Javed Moon
Nabeel Javed Moon

Reputation: 11

You can also use ng-click on your button like this..

<div class="col-90" > <button ng-click="zPLysearch()" class="button button-delete">zPLY search</button> </div>

Upvotes: 1

Balanjaneyulu K
Balanjaneyulu K

Reputation: 4324

function zPLysearch()
{
  console.log("test");
}
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<div class="col-90" >
  <button onclick="zPLysearch()" class="button button-delete">zPLY search</button>
  
</div>
</body>
</html>

Upvotes: 0

Related Questions