1
我想設置一個HTML元素的風格,我閱讀,我必須這樣做,這樣說:this.get在控制器是「不」的函數
bid: {
popUpContainerDisplay: "none",
popUpDisplay: Ember.computed('bid.popUpContainerDisplay', function() {
return Ember.String.htmlSafe("display: " + this.get('bid.popUpContainerDisplay'));
})
},
然後在我的HBS文件我寫
<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(…)
我在做什麼錯?謝謝。
我遇到了一個服務的問題,它已經有'Ember.Service.extend()' –