javascript - Ember.js computed property not firing -


i have computed property thats not firing when checkbox checked. need switch property's value 1 0 if checked.

app.address = ember.object.extend({   shiptype: 1,    shiptype: function() {     var type = this.get('shiptype');     if (type === 1) {       type = 0;       return type;     } else {       type = 1;       return type;     };   }.property('shipcommerical') })  

and in template:

<label>{{view ember.checkbox checkedbinding='shipcommerical'}} check me </label> 

i have other computed properties located in same place , in same way. difference text fields , not checkboxes. make difference?

well, you've got ship commercial spelled incorrectly, appears have spelled incorrectly in both places. additionally have recursive loop computed property needs itself, i'm going assume meant use shipcommercial instead of shiptype inside computed property.

template

<label>{{input type='checkbox' checked=shipcommercial}} check me </label> 

properties

shipcommercial:true, shiptype: function() {   var shipcommercial = this.get('shipcommercial');   return shipcommercial ? 0 : 1; }.property('shipcommercial') 

example

http://emberjs.jsbin.com/zimopise/1/edit


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -