Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : can.Observe.attr() issue

$
0
0
I think I see a few things here.

First, you would have to do the following:
  1. Entry.curr.attr(entries[0].attr());
Here's why. You are trying to set the attributes (attr) of Entry.curr and the attr() function expects a name/value pair or an object containing several of them. http://canjs.us/#can_observe-attr

Trying to pass in entries[0] is passing in a can.Observe (actually a can.Model), not the attributes. The .attr() function does not take a can.Observe as an argument. But passing entries[0].attr() results in passing in entries[0]'s attributes. That is why that works.

You could also probably do the following:
  1. Entry.curr = entries[0];

That is my first take on what I see. I really didn't look much further than that. 

Viewing all articles
Browse latest Browse all 3491

Trending Articles