2

i created a "todolist" with angular-meteor (meteor add urigo:angular). This are the files which are involved:

config.js (ui-router file)

  .state('app.todolist', {
  url: '/todolist',
  title: 'Todolist',
  controller: 'TodoListController',
  controllerAs: 'tc',
  templateUrl: helper.basepath('todolist.ng.html'),
  authenticate: true
})  

todolist.ng.html (static file)

<h3>Todo - List
<small>Example app of a todo list.</small>
</h3>
<ul ng-repeat="task in tc.tasks">
    <li>{{task.text}}</li>
</ul>

todolist.js (Controller)

angular.module('angle').controller('TodoListController',
['$scope', '$meteor', 
function($scope, $meteor){
    var vm = this;

    vm.tasks = $meteor.collection(Tasks);
}]
);

the "tasks" collection is loaded in the "lib" folder and has documents inserted

meteor:PRIMARY> db.tasks.find()
{ "_id" : ObjectId("55bf7d98251a0c51417732bf"), "text" : "zweiter eintrag", "createdAt" : ISODate("2015-08-03T14:41:28.534Z") }
{ "_id" : ObjectId("55bf7dab251a0c51417732c0"), "text" : "zweiter eintrag", "createdAt" : ISODate("2015-08-03T14:41:47.045Z") }
{ "_id" : ObjectId("55bf7dac251a0c51417732c1"), "text" : "zweiter eintrag", "createdAt" : ISODate("2015-08-03T14:41:48.685Z") }
{ "_id" : ObjectId("55bf7dad251a0c51417732c2"), "text" : "zweiter eintrag", "createdAt" : ISODate("2015-08-03T14:41:49.003Z") }
{ "_id" : ObjectId("55bf7dad251a0c51417732c3"), "text" : "zweiter eintrag", "createdAt" : ISODate("2015-08-03T14:41:49.261Z") }

lib/js/databases.js

Tasks = new Mongo.Collection('tasks');

But when I run my app and click on the "Todolist" I can't see anything. It doesnt list any task.text... If I use a static array instead of mongodb everything works fine. (for example: vm.tasks = [{ text: "Task1" },{ text: "task2" }]; ).

But with mongodb noting is showing. I checked the database connection, this works. I dont get any errors, when loading the app and accessing the "Todolist".

Any ideas?

Regards, Simon

3
  • 1
    Do you still have the autopublish package installed? If not, you need to publish and subscribe to your collection. Commented Aug 3, 2015 at 15:54
  • yes I still have installed it. Commented Aug 3, 2015 at 21:09
  • Are there some other ideas? Commented Aug 4, 2015 at 5:29

1 Answer 1

2

Ok problem is solved. I created the databases.js in the "myapp/client/lib" folder instead of the pure "myapp/lib" folder.

bad mistake... but its solved :) Thanks for help!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.