我从controller.ts文件中传递选项:
this.options = {
key: this.key,
plan: response.responseData.plan_code,
email: 'usertest@mailinator.com',
amount: response.responseData.amount,
ref: this.reference
};
&在我的controller.html文件中:
<button class="mt-3 btn-global blue-btn"
angular4-paystack
[paystackOptions]= "{{ options | json }}"
(paymentInit)="paymentCancel()"
(close)="paymentCancel()"
(callback)="paymentDone($event)">Pay with Paystack
</button>
它给我模板解析(插值)的错误,但是当我放置以下代码时
{{ options | json }}
它按原样打印数据。
{ "key": "pk_test_myPublicKey", "plan": "PLN_0hmp3uju90o9rao", "email": "usertest@mailinator.com", "amount": "50000", "ref": "ref-34625380671166" }
请帮助!!!
答案 0 :(得分:0)
尝试一下。只需删除括号和json管道即可。您不应该传递模板语法,而只需传递变量。
<button class="mt-3 btn-global blue-btn"
angular4-paystack
[paystackOptions]= "options"
(paymentInit)="paymentCancel()"
(close)="paymentCancel()"
(callback)="paymentDone($event)">Pay with Paystack
</button>