我从事过Angle 6应用程序的研究。我已使用ngx-card在付款页面上显示卡。但是它显示错误。 错误:-
错误TypeError:无法读取位于以下位置的未定义属性'getAttribute' 新卡(card.js:125)位于 NgxCard.push ../ node_modules / ngx-card / card.js.NgxCard.ngAfterViewInit (card.js:41)在callProviderLifecycles(core.js:9567)在 callElementProvidersLifecycles(core.js:9541)位于 在checkAndUpdateView的callLifecycleHooksChildrenFirst(core.js:9531) (core.js:10467)在callViewAction(core.js:10699)在 execComponentViewsAction(core.js:10641)位于checkAndUpdateView (core.js:10464)在callViewAction(core.js:10699)
我的组件代码是:- appComponent.ts:-
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, FormBuilder} from '@angular/forms';
export class appComponent implements OnInit{
FormOne : FormGroup;
constructor(private formGroup : FormBuilder) {
}
ngOnInit() {
this.FormOne = this.formGroup.group({
card_number : ['', [Validators.required]],
card_name : ['', [Validators.required]],
cvv : ['', [Validators.required]],
expiry_date : ['', [Validators.required]]
});
}
}
app.component.html:-
<form card container=".card-container" [formGroup] = "FormOne">
<input matInput type="text" placeholder="Card Number" formControlName="card_number" card-number>
<input matInput type="text" placeholder="Name" formControlName="card_name" card-name>
<input matInput type="text" placeholder="CVV" formControlName="cvv" card-cvc>
<input matInput type="text" placeholder="Expiry Date (01/10)" formControlName="expiry_date" card-expiry>
<div>
<div class="card-container"></div>
</div>
</form>