help with Working life example of shopping cart screen (new to everything :-) )

31 views
Skip to first unread message

Gabriel Cirstea

unread,
Aug 11, 2011, 7:03:22 AM8/11/11
to KnockoutJS
Hi All ..
any chance some one can have a look at this ..
I think is something wrong with my setup .. not sure

I am getting some errors trying to delete cart line ..
saying cartView Model not defined although i think i set it up as it
should ..

from my firebug .. cartViewModel is not defined

included everything in the js source area between the
$(function(){

)
except the the convert currency function
which seems to work only outside the jquery $(function (){})

has anyone a working of this example in the jsfiddle or any solution
to how to fix ..


thanks a lot

rpn

unread,
Aug 11, 2011, 8:18:38 AM8/11/11
to knock...@googlegroups.com
Hello and welcome!  

Here is the cart editor in jsFiddle: http://jsfiddle.net/rniemeyer/A7K8W/

Maybe you can reproduce your issue based off of it.

Gabriel Cirstea

unread,
Aug 11, 2011, 9:18:47 AM8/11/11
to KnockoutJS
Thank you very much !!

Gabriel Cirstea

unread,
Aug 11, 2011, 10:26:25 AM8/11/11
to KnockoutJS
HI .. just tried to get i work

other than
<code>
<script type='text/javascript' src='jquery-1.5.1.min.js'></script>
<script type='text/javascript' src='jquery.tmpl.js'></script>
<script type='text/javascript' src='knockout.js'></script>
<script type='text/javascript' src='sampleProductCategories.js'></
scrip>
<script type='text/javascript' src='knockout.js'></script>
<code>


is there other dependency ? Everything works except removing the
lines .. Which I don't understand why
this is my page ..

http://scrp.at/adO

working on linux with netscape ..


On Aug 11, 2:18 pm, rpn <rnieme...@gmail.com> wrote:

Gabriel Cirstea

unread,
Aug 11, 2011, 3:45:16 PM8/11/11
to KnockoutJS
Hey thanks for your help ..

Just removed the var in front of

cartViewModel = new cart();
instead of
var cartViewModel = new cart();

and just worked ..

How crazy is that ..
But how could this be ?

Anyway solved .. it seems that if the error comes var viewModel not
defined while is wel defined removing the var in front of it will make
it work :-)



On Aug 11, 2:18 pm, rpn <rnieme...@gmail.com> wrote:

Mark Bradley

unread,
Aug 11, 2011, 8:45:56 PM8/11/11
to knock...@googlegroups.com
On Fri, Aug 12, 2011 at 5:45 AM, Gabriel Cirstea <ned.ga...@gmail.com> wrote:
> Hey thanks for your help ..
>
> Just removed the var in front of
>
> cartViewModel = new cart();
> instead of
> var cartViewModel = new cart();

using var makes cartViewModel a local variable (local to this function
$(function() { ... })). Removing it makes it a global variable, so it
can be accessed outside that function.

>
> and just worked ..
>
> How crazy is that ..
> But how could this be ?
>
> Anyway solved ..  it seems that if the error comes var viewModel not
> defined while is wel defined removing the var in front of it will make
> it work :-)
>
>
>
> On Aug 11, 2:18 pm, rpn <rnieme...@gmail.com> wrote:
>> Hello and welcome!
>>
>> Here is the cart editor in jsFiddle:http://jsfiddle.net/rniemeyer/A7K8W/
>>
>> Maybe you can reproduce your issue based off of it.

--
-barkmadley
sent from an internet enabled device
http://barkmadley.com

Reply all
Reply to author
Forward
0 new messages