从我的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);