I have a beginner issue with my AngularJS very simple code: I'm trying to pass data from a factory to a controller and print the object returned to my view, here's my code:
angular.module('app').factory('blogFactory',function(){
return {
//EDIT
post:{"author":"Bob","name":"smith","content":"some content"},
read: function(){
return this.post;
}
}
});
In the controller:
angular.module('app').controller('MainCtrl',['$scope','blogFactory'], function($scope, blogFactory){
$scope.datas = blogFactory.read();
console.log($scope.datas);});
When I console.log($scope.datas it logs the object fine. In the view I 'm unable to access the object's properties:
<section class="overview">
<article ng-repeat="data in datas">
<p>{{data.name}}</p> //Doesn't display anything
<p>{{data}}</p> // Displays the object
</article>
</section>
Does anyone has any idea? Thanks in advance