Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

Ionic ng-click not working properly with div

$
0
0

Hi everyone, I am currently having a problem with using ng-click not firing.

This is the code of html:

<ion-view title = "Venue" ng-app = "starter">
	<ion-content overflow-scroll="true" ng-controller = "venueCtrl">
		<div class = "card" collection-repeat = "venue in venues">
			<div class = "item item-divider" ng-click = "headerClick()">{{ venue.name }}</div>
			<div class = "item item-divider venue-button">
				<button ng-click = "doAlert()" class = "button button-positive">Add to Favourite</button>
			</div>
				<br/><br/>
		</div>
	</ion-content>
</ion-view>

This is my controller:

myApp.controller ("venueCtrl", ["$scope", function($scope) {
  venues = [];
  $scope.venues = venues; //I have hard code some data in here. Nothing special
  $scope.headerClicked = function (index) {
     console.log("123");
  }
  $scope.doAlert = function() {
    console.log("345");
  }
}])

For some reason, only the doAlert function firing when I click the button. The div, however, not doing any logging when being clicked. I have went through some of the same problems on StackOverflow but most of them are some silly things. Not sure whether mine are one.


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>