Angular “选择器”;应用程序订阅“;不匹配任何元素
我必须为我的一个网站创建一个模式。我已经为此实现了ngx引导模式。 我已经在引导中定义了组件。它运行得很好,但当我查看控制台时,它会显示错误消息 选择器“应用程序订阅”与任何元素都不匹配 下面是subscription.component.ts的代码段Angular “选择器”;应用程序订阅“;不匹配任何元素,angular,ngx-bootstrap-modal,Angular,Ngx Bootstrap Modal,我必须为我的一个网站创建一个模式。我已经为此实现了ngx引导模式。 我已经在引导中定义了组件。它运行得很好,但当我查看控制台时,它会显示错误消息 选择器“应用程序订阅”与任何元素都不匹配 下面是subscription.component.ts的代码段 export class SubscriptionComponent implements OnInit { closeBtnName: string; public email_id; subscribed:Boolean= fal
export class SubscriptionComponent implements OnInit {
closeBtnName: string;
public email_id;
subscribed:Boolean= false;
showsubscribe: Boolean = true;
public emailFormControl = new FormControl('', [ Validators.required, Validators.pattern(EMAIL_REGEX)]);
constructor( public bsModalRef: BsModalRef, private
submit_service:
SubmitService, private modalService: BsModalService) { }
ngOnInit() {
}
if(this.router.url.includes('subscribe')){
this.bsModalRef = this.modalService.show(SubscriptionComponent)
this.bsModalRef.content.closeBtnName = 'Close'
}
}
对于home.component.ts
export class SubscriptionComponent implements OnInit {
closeBtnName: string;
public email_id;
subscribed:Boolean= false;
showsubscribe: Boolean = true;
public emailFormControl = new FormControl('', [ Validators.required, Validators.pattern(EMAIL_REGEX)]);
constructor( public bsModalRef: BsModalRef, private
submit_service:
SubmitService, private modalService: BsModalService) { }
ngOnInit() {
}
if(this.router.url.includes('subscribe')){
this.bsModalRef = this.modalService.show(SubscriptionComponent)
this.bsModalRef.content.closeBtnName = 'Close'
}
根据ngx引导文档,我在entryComponents中添加了这一点。
app.module.ts的代码段
bootstrap: [AppComponent, SubscriptionComponent]
请给我一个解决方案。确保您已经在模块的
entryComponents
数组中添加了SubscriptionComponent
。确保您已经在模块的entryComponents
数组中添加了SubscriptionComponent
。谢谢!我已经从引导中删除了它,并将其添加到entryComponents中。现在工作正常。:-)很高兴提供帮助,欢迎使用Stack Overflow。如果此答案或任何其他答案解决了您的问题,请将其标记为已接受。谢谢!我已经从引导中删除了它,并将其添加到entryComponents中。现在工作正常。:-)很高兴提供帮助,欢迎使用Stack Overflow。如果此答案或任何其他答案解决了您的问题,请将其标记为已接受。