Hi!
This issue is illustrated in this fiddle.
I'm experiencing an issue with can.Observe.attr() when passing another Observe as parameter, such as in line 11:
- can.Model('Entry', {
- findAll: 'GET /entries',
- curr: new can.Observe({}),
- list: new can.Observe.List([])
- }, {});
- // Inside a can.Control method:
- Entry.findAll({}, function(entries) {
- Entry.list.replace(entries);
- if (entries.attr('length') > 0) {
- Entry.curr.attr(entries[0]);
- }
- }
I get two errors. The first call to attr() results in:
TypeError: name.split is not a function @ http://canjs.us/release/latest/can.jquery.js:141
Then, all subsequent calls to attr() result in:
TypeError: curVal.attr is not a function @ http://canjs.us/release/latest/can.jquery.js:772
One solution I found is calling Entry.curr.attr(entries[0].attr()); but I think Entry.curr.attr(entries[0]); should work.
Hearty thanks for any help anyone can provide =)
P.S.: Comments regarding other aspects of the fiddle are as much appreciated!
-- Pablo Aguiar (scorphus)