私はいくつかのhtmlをemberのコンポーネントに渡しています。html が生成されます。しかし、生成された html は、コンポーネントで定義されたプロパティにアクセスできません。ただし、プロパティはコンポーネント テンプレートで機能します。
成分
import Ember from 'ember';
export default Ember.Component.extend({
user: undefined,
replyText: undefined,
onInitialization: function(){
this.set('replyText', '@' + this.user.get('username') + ' ');
}.on("init"),
remainingTweetChars: function () {
var length = 140 - this.get('replyText').length;
return length;
}.property('replyText')
});
コンポーネント テンプレート
{{remainingTweetChars}} {{!-- this works --}}
{{yield}}
上記のコンポーネント テンプレートに生成される html でのコンポーネントの使用
{{#action-reply class="item-actionables__reply"
user=user
}}
<span>{{remainingTweetChars}}</span> {{!-- this does NOT works --}}
<span>{{view.remainingTweetChars}}</span> {{!-- this does NOT works --}}
{{/action-reply}}