ember でモーダル ボックス コンポーネントを構築しようとしています。モーダル ボックスには、「閉じる」と「保存」という 2 つの標準ボタンがあります。コントローラー アクションをこのコンポーネントに渡して、保存ボタンをクリックすると、渡されたコントローラー アクションが呼び出されるようにしたいと考えました。コンポーネントを次のように呼び出します。
{{#affi-modal-box title="Test title" modalId="createNewAnalyticsRunModal" controllerBinding=controller}}some message{{/affi-modal-box}}
と私のコンポーネント:
AS.AffiModalBoxComponent = Ember.Component.extend({
attributeBindings: ['modelId','test'],
//this is the function that gets called when save button is clicked
onSaveButtonClick : function(){
console.log(this.controllerFor('analysisTemplates'));//fails
console.log(this.get('controller'));//returns modal box component which I don't need
}
});
コントローラーオブジェクトをコンポーネントに渡す方法はありますか??
ありがとう。