angularjs - Angular resources doesn't fill scope -


I have a simple controller with a service as a dependency. When the promise is made to resources , then I am trying to fill the scope. When I console.log () scope shows it correctly with the data, but my ng-repeat does not work. Besides, I have an extension of chrome I am using and (post) on that radius does not show any data what am I missing?

Controller:

  Function Timeline Controller ($ Scope, Timeline Service) {$ scope.posts = []; $ Scope.getPosts = function (wall_type, wall_id) {timeline service. Tags (wall-type, wall_id). $ Promise Then (function (result) {$ scope.posts = result.response; console.log ($ scope.posts); // shows data correctly on this console}}}}}  

service timeline service ($ resource) {var resource = $ resource ('/ timeline /: post id', {postId: "@ id"}); return {getPosts: Function (unit, id) {// / timeline? Entity = user & amp; id = 3 (example url) return resource.get ({unit: entity, id: id});}}} < / Pre>

The response from the server is:

  {Success: True, the response Or: [...]}  

Edit:

I have the template in the ng-repeat I'm using a command to display:

  function timeline () {return {restrict: 'e', ​​replace: correct, scope: {type: '@', ID: '@', Answer: '& amp;}, TemplateUrl: "/ js / templates / timeline / post-tmpl.html"}};  

So in my opinion: / P>

  & lt; div class = "col-md-8" ng-controller = "timeline controller" & gt; & Lt; Timeline type = "user" id = "8" postim = "getPosts (wall_type, wall_id)" & gt; & Lt; / Timeline & gt; & Lt; / Div & gt;  

and the smaller version of my template:

   

I think the data needs to be implemented and digested because the service function controller Not a part of the area.

Before or after your console.og, run a $ area within your controller. $ Applied () .

If the $ or $ digest is already in progress then you can wrap the $ value $ $ range. $ To apply () with setTimeout with a delay, or you can set it to $ scope. $ EvalAsync () .


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -