2016-12-27 1 views
1

私はhtml要素のスタイルを設定しようとしていると私はそれをこのようにしなければならないことを読んで、私はthis.getは「ない関数」

<div id="popUpContainer" style={{bid.popUpDisplay}}> 

を書くしかし、これは私にいくつかのエラーを与えている:私は間違って

jQuery.Deferred exception: this.get is not a function TypeError: this.get is not a function 
at Object.<anonymous> (http://localhost:4200/assets/auction-ember.js:53:77) 
at ComputedPropertyPrototype.get (http://localhost:4200/assets/vendor.js:26852:28) 
at Object.get (http://localhost:4200/assets/vendor.js:31759:19) 
at NestedPropertyReference.compute (http://localhost:4200/assets/vendor.js:24910:28) 
at NestedPropertyReference.value (http://localhost:4200/assets/vendor.js:24720:45) 
at ReferenceCache.initialize (http://localhost:4200/assets/vendor.js:55111:52) 
at ReferenceCache.peek (http://localhost:4200/assets/vendor.js:55085:29) 
at DynamicAttribute.flush (http://localhost:4200/assets/vendor.js:58752:35) 
at SimpleElementOperations.addAttribute (http://localhost:4200/assets/vendor.js:58414:36) 
at SimpleElementOperations.addDynamicAttribute (http://localhost:4200/assets/vendor.js:58374:22) undefinedjQuery.Deferred.exceptionHook @ jquery.js:3846process @ jquery.js:3642 

jquery.js:3855Uncaught TypeError: this.get is not a function(…) 

何をしているのですか?ありがとう。

答えて

1

getメソッドは、使用しようとしているオブジェクトの内部に存在しません。

そのgetの方法は、Ember.Observableであり、Ember.Objectクラスで使用されています。

bid: Ember.Object.extend({ 
    popUpContainerDisplay: "none", 
    popUpDisplay: Ember.computed('bid.popUpContainerDisplay', function() { 
     return Ember.String.htmlSafe("display: " + this.get('bid.popUpContainerDisplay')); 
    }) 
}) 
+0

この問題は既にEmber.Service.extend()にあります。 –

0

あなたがbidのうち、計算されたプロパティを配置する必要があります:何がしなければならないことは拡張または作成し、このようにいずれかを使用して、Ember.Objectとしてbidプロパティを宣言しています。

bid: { 
    popUpContainerDisplay: "none" 
}, 
popUpDisplay: Ember.computed('bid.popUpContainerDisplay', function() { 
    return Ember.String.htmlSafe("display: " + this.get('bid.popUpContainerDisplay')); 
}) 
関連する問題