Questions tagged [canjs-map]
4 questions
2
votes
1 answer
CanJS models: attr function and nested data
In canJS I can set a model property with person.attr('name', 'John Doe');, but sometimes that property contains nested data, so I need to do the following:
var address = person.attr('address');
// Update country
address.country = 'USA';…

Tamás Pap
- 17,777
- 15
- 70
- 102
1
vote
1 answer
How can I construct a can.Map with computed values that behave like normal attributes?
Let's say I have a map:
map = new can.Map({foo: 'bar'})
and I want to bind the value of foo in another map. I could do:
otherMap = new can.Map({fizzle: map.compute('foo')})
but this doesn't behave the way I would expect.
I would expect…

Tony Novak
- 11
- 1
1
vote
2 answers
Understanding Canjs Control sample
Am looking at the Canjs Sample for Control.
TaskStriker = can.Control({
"{task} completed": function(){
this.update();
},
update: function(){
if ( this.options.task.completed ) {
this.element.addClass(…

Aravind R
- 716
- 1
- 10
- 36
0
votes
2 answers
Validate Dynamic Object using can.Map.Validate
I was looking for form validation in CanJS and came to know about can.Map.Validate plugin http://canjs.com/docs/can.Map.validations.prototype.errors.html
In the below example taken from the documentation itself, we need to give the properties of the…

Ankur Aggarwal
- 2,993
- 5
- 30
- 56