{"action":"created","issue":{"url":"https://api.github.com/repos/ManuelDeLeon/viewmodel/issues/66","labels_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel/issues/66/comments","events_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel/issues/66/events","html_url":"https://github.com/ManuelDeLeon/viewmodel/issues/66","id":87199242,"number":66,"title":"Issue with nested viewmodels","user":{"login":"sveinburne","id":3646758,"avatar_url":"https://avatars.githubusercontent.com/u/3646758?v=3","gravatar_id":"","url":"https://api.github.com/users/sveinburne","html_url":"https://github.com/sveinburne","followers_url":"https://api.github.com/users/sveinburne/followers","following_url":"https://api.github.com/users/sveinburne/following{/other_user}","gists_url":"https://api.github.com/users/sveinburne/gists{/gist_id}","starred_url":"https://api.github.com/users/sveinburne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sveinburne/subscriptions","organizations_url":"https://api.github.com/users/sveinburne/orgs","repos_url":"https://api.github.com/users/sveinburne/repos","events_url":"https://api.github.com/users/sveinburne/events{/privacy}","received_events_url":"https://api.github.com/users/sveinburne/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-11T03:48:31Z","updated_at":"2015-06-11T21:10:02Z","closed_at":null,"body":"I have an issue with nested viewmodels. The issue seems to occur at random times (from my point of view). `binds.coffee`, line 47 complains that `role`  is not found on viwmodel. But the printed viewmodel is the parent... the data binding I'm using is `checked:role` for a radio button. If I add the `role` property to blaze (by passing `'role'` as a second argument to the `viewmodel` function), it does print it within a `{{role}}`. \r\nOne more element that might help is that the nested template is included multiple times within a `{{#each}}` loop, and **only the second to the last elements in the loop trigger this console output**. So perhaps it has to do with multiple occurrences of the same viewmodel in the same page? \r\nLast clue : the issue appears only when I refresh the page. If I navigate with the router inside my application, and go back to the problematic page, the issue does not appear again.\r\nLastly, if I print the `role`  value assigned during viewmodel construction, it does prints as expected. Any idea? "},"comment":{"url":"https://api.github.com/repos/ManuelDeLeon/viewmodel/issues/comments/111278328","html_url":"https://github.com/ManuelDeLeon/viewmodel/issues/66#issuecomment-111278328","issue_url":"https://api.github.com/repos/ManuelDeLeon/viewmodel/issues/66","id":111278328,"user":{"login":"ManuelDeLeon","id":4257750,"avatar_url":"https://avatars.githubusercontent.com/u/4257750?v=3","gravatar_id":"","url":"https://api.github.com/users/ManuelDeLeon","html_url":"https://github.com/ManuelDeLeon","followers_url":"https://api.github.com/users/ManuelDeLeon/followers","following_url":"https://api.github.com/users/ManuelDeLeon/following{/other_user}","gists_url":"https://api.github.com/users/ManuelDeLeon/gists{/gist_id}","starred_url":"https://api.github.com/users/ManuelDeLeon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManuelDeLeon/subscriptions","organizations_url":"https://api.github.com/users/ManuelDeLeon/orgs","repos_url":"https://api.github.com/users/ManuelDeLeon/repos","events_url":"https://api.github.com/users/ManuelDeLeon/events{/privacy}","received_events_url":"https://api.github.com/users/ManuelDeLeon/received_events","type":"User","site_admin":false},"created_at":"2015-06-11T21:10:02Z","updated_at":"2015-06-11T21:10:02Z","body":"I'm sorry but I can't help you there. It's way too much code to review. Here are my thoughts from glancing at it:\r\n* You're mixing too much Blaze and ViewModel together. You can probably get it done without blaze helpers or events.\r\n* You're closing over your variables. For example you define userId then create a vm with a userId property and then use \"userId\" inside a function.\r\n* That autorun is very clunky to say the least. You can probably do without it. At the very least replace it with the built in 'change' bind or 'autorun' on the viewmodel. For example:\r\n```\r\nTemplate.name.viewmodel({\r\n  name: '',\r\n  autorun: function() {\r\n    if (this.name()) console.log(this.name());\r\n  }\r\n})\r\n```\r\nI hope this helps."}}