ng-click function is not working on tabs in AngularJs?

1,352 views
Skip to first unread message

kapil.co...@gmail.com

unread,
Jul 28, 2017, 6:07:51 AM7/28/17
to Angular and AngularJS discussion
Hello sir i have to call function for get the list of albums but in my case ng-click is not working no action will be performed what's wrong in my code?

	//Our controller code here
      /**
	 * @Summary: getAlbumsBySellerUserTypeKeyId function, get the productsAlbum list
	 * @param: NA
	 * @return: allAlbums
	 * @Description:
	 */	
	$scope.allAlbums = [];
	$scope.sellerUserTypeKeyId = [];
	$scope.getAlbumsBySellerUserTypeKeyId = function() {
		//Enable class fadeAndDisable call the getAlbumsBySellerUserTypeKeyId() function
		$("#loadingAlbums").toggleClass("fadeAndDisable", true);
		
		$scope.sellerUserTypeKeyId = Number(AUTH.userTypeKeyId);
		var PRODUCT_DB_REF = firebase.database().ref('datastore/productsAlbum');
	
		
		//Re-enable class fadeAndDisable after response is received
		$("#loadingAlbums").toggleClass("fadeAndDisable", false);
		
		PRODUCT_DB_REF.orderByChild("sellerUserTypeKeyId").equalTo($scope.sellerUserTypeKeyId)
		.on("value", function(snapshot) {
			 var value = snapshot.val();
			 if(value != null) {
				$scope.allAlbums = objToArray(value);
				//USED FOR SET THE ALBUM LENGTH IN THE ALBUM TABS SECTION
				$rootScope.allAlbums = $scope.allAlbums;
			 }
		});
	}
//This is our HTML Code
 <li class="ng-cloak">
        <a href="javascript:void(0)" onclick="openPageTab(event, 'createAlbum')"
        ng-click="getAlbumsBySellerUserTypeKeyId()">
        Album
      <span ng-if="allAlbums.length > 0">({{allAlbums.length}})</span> 
    </a>
    </li>

Sander Elias

unread,
Jul 28, 2017, 11:43:58 AM7/28/17
to Angular and AngularJS discussion
Probably the click is swallowed by the onclick="openPag...", and never reaches the angular clickhandler.

Regards
Sander

kapil soni

unread,
Jul 28, 2017, 12:11:36 PM7/28/17
to ang...@googlegroups.com
But Mam I have to call both the function in a tab so it is possible or not?

From: Sander Elias
Sent: ‎28-‎07-‎2017 09:14 PM
To: Angular and AngularJS discussion
Subject: [AngularJS] Re: ng-click function is not working on tabs inAngularJs?

Probably the click is swallowed by the onclick="openPag...", and never reaches the angular clickhandler.

Regards
Sander

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

santosh...@bostonbyte.com

unread,
Jul 29, 2017, 4:33:36 AM7/29/17
to Angular and AngularJS discussion
You can call two or more function on ng-click="function1(); function2()" from controller 
Reply all
Reply to author
Forward
0 new messages