I have a function in angular:
$scope.getSessionsForSpeaker = function (id) {
$scope.id = id;
$scope.getAll = SessionService.getAll();
$scope.sessionsFound = [];
$scope.getAll.$promise.then(function(data) {
for (var i = 0; i < data.length; i++) {
if ([data[i].speakers[0]] == $scope.id) {
console.log([data[i].subject]);
$scope.sessionsFound += [[data[i].subject] + ", "];
}
}
});
};
and from html i run it by clicking a link:
<a ng-click="getSessionsForSpeaker(speaker.id)"></a>
Is there a way to run this function without clicking? Thank you in advance!!
$scope.getSessionsForSpeaker()speaker.idin that case ?id.