I would advise isEnabled:Em.computed.alias('controller.panoEnabled')
for the second option mentioned by Duncan Walker, as the property with the binding
suffix has been 'softly' deprecated (https://github.com/emberjs/ember.js/issues/1164#issuecomment-23200023).
App.PanoView = Ember.View.extend({
classNames: ['pano'],
classNameBindings: ['isEnabled'],
/*isEnabled:function(){
return this.get('controller.panoEnabled');
}.property('controller.panoEnabled')*/
isEnabled:Em.computed.alias('controller.panoEnabled')
});
Also it is needed to fix the context of this
in the google maps related code as shown below
http://emberjs.jsbin.com/vesiyana/1/edit
....
var self = this;
google.maps.event.addListener(marker, 'click', function(){
self.set('controller.panoEnabled',true);
console.log( self.get('controller.panoEnabled') ); });
google.maps.event.addListener(map, 'click', function(){
self.set('controller.panoEnabled', false);
console.log( self.get('controller.panoEnabled') ); });
....
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…