angularjs - In angular-meteor, document obtained with $meteor.object does not render -


i have angular-meteor program in $meteor.object method returns weird object instead of document.

i writing code similar angluar-meteor turorial (http://angular-meteor.com/tutorial/step_06):

scratch.js:

angular.module("docflow").controller("scratchctrl",      ["$scope", "$rootscope", "$stateparams", "$meteor",     function($scope, $rootscope, $stateparams, $meteor){         $scope.bookid = $stateparams.bookid;         $scope.book = $meteor.object(books, $scope.bookid);     }]); 

scratch.ng.html:

<div>                id: {{ bookid }}<br/>     name: {{ book.name }}<br/>     book: {{ book|json }} </div> 

this gets rendered -- note there nothing after name:

id: dmk7puqzrpctwznnc

name:

book: { "autoruncomputation": { "stopped": false, "invalidated": false, "firstrun": false, "_id": 25, "_oninvalidatecallbacks": [ null, null ], "_parent": null, "_recomputing": false } }


i know book object exists , has name attribute. if directly query mongo rendered id expected object:

meteor:primary> db.books.findone({_id: "dmk7puqzrpctwznnc"}); { "_id" : "dmk7puqzrpctwznnc", "name" : "a", "owner" : "y5zqy4ked9bshddma" } 

why isn't name of book rendered?

okay, seems writing question down helped... problem removed autopublish package, , did not subscribe collection. line:

$scope.book = $meteor.object(books, $scope.bookid); 

must changed

$scope.book = $meteor.object(books, $scope.bookid).subscribe("books"); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -