Click here to Skip to main content
16,019,843 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
unable to get category id in angularjs controller on image click using ng-click.

please share how to get id on ng-click,pass it to the controller and get subcategory images using angularjs and jsonresult in mvc.

What I have tried:

jsonresult
---------------
return Json(dd, JsonRequestBehavior.AllowGet);
Posted
Updated 22-May-16 0:17am
v3

1 solution

In two ways you can do this
replace the ng-model with ng-init
JavaScript
ng-init="x=@item.cat_id" 

or
use event.CurrentTarget.id
JavaScript
$scope.show=function(event)
            { 
               alert(event.currentTarget.id);
            }
 
Share this answer
 
Comments
Karthik_Mahalingam 13-May-16 12:40pm    
stringify the data and send.
JSON.stringify(array)

refer:jquery - Pass array to ajax request in $.ajax() - Stack Overflow[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900