javascript - Calling a function in ng-repeat -
i have <input type="file">
in ng-repeat , want call function whenever value of element changes <input type="file">
element in ng-repeat.
i tried calling $(#"id").change()
function not working. have tried using ng-change, ng-repeat doesnt work when use ng-change. code:
in html
<div ng-repeat="item in items"> <input type="file" accept="image/*" id="add_{{$index}}"/> </div>
in js
$("#add_images").change(function() { alert("hi"); }
why mixing angular , jquery?
you have in angular can use easily!
in html
<div ng-repeat="item in items"> <input type="file" accept="image/*" id="add_images" ng-change="dosomething()"/> </div>
in controller js
$scope.dosomething = function(){ //do whatever want }
Comments
Post a Comment