Re: Uncaught TypeError: Cannot read property 'nodeType' of null

2,841 views
Skip to first unread message

Patrick Steele

unread,
May 29, 2013, 10:02:54 AM5/29/13
to knock...@googlegroups.com
Make sure you call ko.applyBindings in your document.ready handler:

$(function() {
    ko.applyBindings(vm);
});

PS - Props to Ryan Niemeyer since he just answered a similar question that reminded me about this email sitting in my inbox...  :)




On Tue, May 28, 2013 at 5:08 AM, Daman Pradhan <damanp...@gmail.com> wrote:
Hi,

I'm trying the most basic sample in the tutorials and I'm getting an error:

"Uncaught TypeError: Cannot read property 'nodeType' of null " in the console window of Chrome from the knockoutjs library (2.2.1).

I've attached my code and the libraries I'm using. Any help will be much appreciated.

Thanks !!!

--
You received this message because you are subscribed to the Google Groups "KnockoutJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to knockoutjs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

baris...@markafoni.com

unread,
Aug 14, 2014, 6:19:32 AM8/14/14
to knock...@googlegroups.com
Hello,

The first question to ask is if you have used another view-model in the same view/page. When it happens, this usually occurs since vm's used one more time are stricted to be used by id joined with an element with id in the view/page.

The challange path is here (if the state is like yours):

1) Choose an element and give it an id like "js-vm-viewModelName1"
2)Choose an element and give it an id like "js-vm-viewModelName2"
3) Execute the applyBindings() for the viewModel objects like this: ko.applyBindings('custom-view-model-name', viewModel, 'js-vm-viewModelName1'); and ko.applyBindings('custom-view-model-name', viewModel, 'js-vm-viewModelName2');
4) Reload the page again,

Kind regards.

29 Mayıs 2013 Çarşamba 17:02:54 UTC+3 tarihinde Patrick Steele yazdı:
Reply all
Reply to author
Forward
0 new messages