This is my code:
I have my app.module.ts
import { CustomAlertComponent } from './pages/common/custom-
alert.component';
@NgModule({
imports: [...],
exports: [ ..., CustomAlertComponent],
declarations: [.., CustomAlertComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
custom-alert.component.html
<ngb-alert *ngIf="!staticAlertClosed" [type]="type" (close)="true">{{message}}</ngb-alert>
custom-alert.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(){}
}
and start-workflow.component.ts
import { Component, OnInit, ViewEncapsulation, ViewContainerRef, Input, Output, EventEmitter } from '@angular/core';
import { CustomAlertComponent } from '../common/custom-alert.component';
@Component({
selector: 'start-workflow',
templateUrl: 'start-workflow.component.html',
styleUrls: ['../../../assets/scss/plugins/_datepicker.scss', 'start-
workflow.component.css']
})
export class StartWorkflowComponent implements OnInit{
message: string;
type: string;
staticAlertClosed:boolean = false;
constructor() {}
public method(){
this.message= 'Archivo enviado y guardado';
this.type= 'success';
this.staticAlertClosed = true;
}
}
I'm having the following error:
Blockquote core.js:1440 ERROR Error: Uncaught (in promise): Error: Template parse errors: Can't bind to 'message' since it isn't a known property 1. If 'custom-alert' is an Angular component and it has 'message' input, then verify that it is part of this module. 2. If 'custom-alert' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. 3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. (" ][(message)]="text"> "): ng:///StartWorkflowModule/StartWorkflowComponent.html@1:16 'custom-alert' is not a known element:
Please help
ngb-alert
module ? – wentjun