I am trying to get a dynamic id to my array(details) within my ng-repeat so that I can bind to different data with different view of child div. Let me show an example.
data-ng-click="collapse($event, data.id)"
data-target="#view_{{data.id}}"
data-toggle="collapse" aria-expanded="false">
Id | Instance | |
---|---|---|
My problem is when I click on my parent div, I want to map child div with new data, Is it possible to set a dynamic ID in this concept?
Js:
$scope.details = [];
$scope.collapse = function (event, requestId) {
var deferred = $q.defer();
var idx = 0;
service.getDetail(requestId)
.then(function (response) {
$scope.details[requestId] = response;
deferred.resolve();
}, function (error) {
console.log(error);
deferred.reject();
});
return deferred.promise;
}
};