I have implemented a method in my controller where I pass a dynamic id using the ng-init function, fetch a response through ajax calls, and try to print the response. However, I am facing an issue as the response is not getting printed. I am using ng-repeat to iterate over a list and calling ng-init for each element in the list. Despite this, the view does not get updated with the response.
Here is the HTML code snippet:
<div class="col-xs-12 chalg-list" ng-repeat="element in elements">
<div class="col-sm-10 col-xs-9 pzero" ng-init="getActivity(element.id)">
<p><span>Activity Names</span> <span>{{names._element.id}}</span></p>
</div>
</div>
And here is the corresponding Javascript code:
$scope.getActivity(_id){
//getting response through ajax calls
$scope.names._id = data; //every time a dynamic id will come but the view doesn't update
console.log($scope.activities._id)
}
If anyone could kindly assist me, it would be greatly appreciated as I am running out of time.