I have a query to an API that theoretically is returning the data, at least in the console shows me the same. But in View with ng-repeat
is not bringing anything.
Below is 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.