How to make a dynamically retrieved image clickable in angularjs -
i have retrieved image , corresponding data dynamically, in want make image clickable redirect webpage. how can achieve using angularjs.
i using angularjs, no jquery.
below can see can assign values object , use object on image tag. if want make other changes on click can use ng-click shown below use $location.url.
$scope.object = {}; $scope.object.filepath = filepath; $scope.object.redirecturl = redirecturl <img ng-src="object.filepath" ui-sref="{{object.redirecturl}}" /> $scope.redirect = function(redirecturl) { $location.url(redirecturl); }; <img ng-src="object.filepath" ng-click="redirect(redirecturl)" />
Comments
Post a Comment