小编Lil*_*nos的帖子

无法绑定到“属性”,因为它不是“组件”的已知属性

这是我的代码:

我有我的 app.module.ts

import { CustomAlertComponent } from './pages/common/custom- 
alert.component';
@NgModule({
  imports: [...],
  exports: [ ..., CustomAlertComponent],
  declarations: [.., CustomAlertComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

自定义警报.component.html

<ngb-alert *ngIf="!staticAlertClosed" [type]="type" (close)="true">{{message}}</ngb-alert>
Run Code Online (Sandbox Code Playgroud)

自定义警报.component.ts

import { Component, OnInit, Input, EventEmitter } from '@angular/core';
 @Component({
  selector: 'custom-alert',
  templateUrl: './custom-alert.component.html'
})
export class CustomAlertComponent implements OnInit {

 @Input() message: string;
 @Input() type: string;
 @Input() staticAlertClosed:boolean;

 constructor() {}

 ngOnInit(){}
} 
Run Code Online (Sandbox Code Playgroud)

和 start-workflow.component.ts

import { Component, OnInit, ViewEncapsulation, ViewContainerRef, Input, Output, EventEmitter  } from …
Run Code Online (Sandbox Code Playgroud)

binding angular

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

angular ×1

binding ×1