I have trouble with calling a function when the page loads. I'm not sure what tag I should use within html to run Angular application.
I am trying to pull user data from a database and display it in a table. It works when I use a button to call the function but I would like it to be more automated. I've done some research and it always leads me to using the controller but I am sure there has to be a simpler solution.
<tbody>
<Button ng-click="fetchEveryone();">click</Button>
<tr ng-repeat="user in all_users">
<td>
<img src="/images/{{user.pic}}" style="height: 50px; width: 50px; border-radius: 100px;"/>
</td>
<td>{{user.name}}</td>
<td>{{user.email}}</td>
<td>
<select ng-change="" ng-model="selectedMeeting">
<option value="">Select Meeting Type...</option>
<option ng-repeat="meeting in meetings">{{meeting}}</option>
</select>
</td>
<td>
<button>request</button>
</td>
</tr>
</tbody>
Here is the Angular code. It makes a request to python server.
$scope.fetchEveryone = function(){
var req = {
verb: 'getPeople',
names: $scope.Allusers
}
$scope.callAPI(req, function(response){
$scope.all_users = response;
$scope.view = 'viewPerson'
});
}