Knockout Prototype Issue

34 views
Skip to first unread message

Kabue Charles

unread,
May 12, 2017, 1:56:27 AM5/12/17
to KnockoutJS

i would like to understand why knockout behaves differently when a property is a prototype, and especially important, how to avoid it, while still using prototypes. i want some methods to be overridden because i have a base view model that we are to inherit... the following demonstrates what i mean...


JSFIDDLE WITH PROTOTYPE [try typing into the first input box and it will appear in the other]


JSFIDDLE WITHOUT PROTOTYPE [try typing into the first input box and it will not appear in the other]


Why are they behaving differently?

noirabys

unread,
May 12, 2017, 2:52:07 AM5/12/17
to KnockoutJS
hi,
because prototype in that case works lets say like a global variable 

if you want to share variables pass them into the component model via params parameter:

best regards,
noirabys

Kabue Charles

unread,
May 12, 2017, 3:00:19 AM5/12/17
to knock...@googlegroups.com
+thanks...
but what i want is to have a shared properties, not parameters...

--
You received this message because you are subscribed to a topic in the Google Groups "KnockoutJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/knockoutjs/7OwCVWWit2Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to knockoutjs+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Regards, Kabue Charles (online: mckabue)
Reply all
Reply to author
Forward
0 new messages