1
I have a query to an API that theoretically is returning the data, at least in the console shows me the same. But in the View with the ng-repeat
is not bringing anything.
Below follows the code I’m using:
Factory:
pcFactories.factory('TeacherSrv', function ($http) {
return {
getAllTeachers: function (TTBId) {
$http.get('http://xxx.xxx.xxx/' + TTBId)
.success(function (data) {
return data;
})
.error(function (status) {
return status;
});
}
};
})
Controller
pcControllers.controller('TeacherCtrl', function ($scope, TeacherSrv) {
$scope.teachers = TeacherSrv.getAllTeachers(TTBId);
})
View
<tr ng-repeat="t in teachers" on-finish-render="ngRepeatFinished">
<td>
<img src="Images/no-photo.png" alt="" />
<a href="" class="user-link">{{t.TEAName}}</a>
<span class="user-subhead">{{t.TEAEmail}}</span>
</td>
</tr>
I hope you can help me.
The first thing that comes to mind is: What is the value of Ttbid?. The second is: Where Ttbid receives this amount?
– mutlei
Ttbid is 1. And for now it is being loaded from a $Scope variable in order to run tests for now.
– Jacson Daner M. Brandão