`I did this in the Angular html file:
<div class="modal-body">
<app-add-edit-dep [dep]="dep" *ngIf="ActivateAddEditDepComp">
</app-add-edit-dep>
</div>
Now the error is: Error: src/app/department/show-dep/show-dep.component.html:23:31 - error NG8002: Can't bind to 'dep' since it isn't a known property of 'app-add-edit-dep'.
- If 'app-add-edit-dep' is an Angular component and it has 'dep' input, then verify that it is part of this module.
your text - If 'app-add-edit-dep' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
- To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.'
This is the Angular TS file:
import { Component, OnInit } from '@angular/core';
import { SharedService } from 'src/app/shared.service';
@Component({
selector: 'app-show-dep',
templateUrl: './show-dep.component.html',
styleUrls: ['./show-dep.component.css']
})
export class ShowDepComponent implements OnInit {
constructor(private service:SharedService) { }
DepartmentList:any=[];
ActivateAddEditDepComp:boolean=false;
dep:any;
ModalTitle:string;
ngOnInit(): void {
this.refreshDepList();
}
addClick(){
this.dep={
DepartmentId:0,
DepartmentName:""
}
this.ModalTitle="Add Department";
this.ActivateAddEditDepComp=true;
}
closeClick(){
this.ActivateAddEditDepComp=false;
this.refreshDepList();
}
refreshDepList(){
this.service.getDepList().subscribe(data=>{
this.DepartmentList=data;
});
}
}
You're missing a property "dep" in add-edit-dep component with the decorator @Input()
Input documentation.