我正在使用ember-bootstrap及其模态组件在模板上创建模态。目前,模态组件和触发它的按钮位于同一个模板上,但是我想将模态移动到一个组件中,这样我就可以保持模板代码的干净。
这有效
//application/template.hbs
{{#bs-button onClick=(action (mut modal1) true)}}Open Modal{{/bs-button}}
{{#bs-modal-simple open=modal1 title="Simple Dialog" size="sm" onHidden=(action (mut modal1) false)}}
Hi there
{{/bs-modal-simple}}
这不起作用
//application/template.hbs
{{#bs-button onClick=(action (mut modal1) true)}}Open Modal{{/bs-button}}
{{my-modal}}
//components/my-modal/template.hbs
{{#bs-modal-simple open=modal1 title="Simple Dialog" size="sm" onHidden=(action (mut modal1) false)}}
Hi there
{{/bs-modal-simple}}
我怎样才能得到它,以便从应用程序模板触发模态?