EmberJS - 如何从`child component`调用`parent`组件方法

时间:2017-08-07 06:01:09

标签: ember.js ember-components

从我的rootcomponent我将数据传递给child component。我可以通过将model分配给属性来传递数据。同样,我的root component具有on change方法功能,如何从child component调用它。

意思是,我不想为我的js保留另一个child component文件。让我保留actions root component hbs<div class="balanceEmi rdc-scroll-content has-subheader rdc-view"> {{cs2i-select-tenure selectedCreditCard=model}} </div> 个文件。

这是我的根组件代码:(将数据发送到子组件)

    <div class="rdc-panel-content">
            <h6 >
                {{selectedCreditCard.attributes.cardName}}
                {{rdc-label text=(card-no-display selectedCreditCard.attributes.cardNo)}}
            </h6>
            <div class="rdc-form-content">
                {{#rdc-form-select label="Pay To" 
                    labelPosition="top" tabindex="0"
                    options=selectedCreditCard.relationships.balances.data
                    selected="Please select a Balance"
                    searchEnabled=false
//how to call onchange to parent component?
                    onchange=(action this.attrs["selectedBalaceType"] ) as |type|
                }}
                {{type}}
                {{/rdc-form-select}}
            </div>

    </div>

这里是子组件hbs文件:

digitalWrite(pin, HIGH);

0 个答案:

没有答案