Currently, I am exploring the wonderful Restangular library and encountering an issue while attempting to fetch JSON objects and bind them to the $scope object.
Within my Factory script, I have a function that returns a list of blogs using the Restangular.getList() method.
angular.module("ecmaworld").factory("Authenticate", function(Restangular) {
// Testing Function
var Blogs = Restangular.all("blogs");
return {
blogs: function() {
Blogs.getList().then(function(blogs) {
return blogs;
}, function(error) {
console.log(error);
});
}
};});
The above Factory method is responsible for returning the blog posts. To utilize this function in one of my controller scripts, I call it like so:
angular.module("ecmaworld").controller("LoginController", function($scope, Authenticate) {
//Testing function
$scope.getBlogs = function() {
$scope.blogs = Authenticate.blogs();
};
});
Despite receiving the JSON objects in the http response when invoking the API method, I face difficulty in displaying the blog posts using the "data-ng-repeat" directive in the VIEW section. I would greatly appreciate any assistance as I navigate through this Angular learning curve.
Thank you.