Opening model from parent component which is existed in child component. Once child functionality completed have to call the parent component METHOD from child component.
i can call the method from child to parent component, but its through warning has Circular dependency detected..
Parent :
parent.html
<child></child>
Parent.ts
import {c_Comp} from 'child.comp'
@Component({
selector: "parent",
templateUrl: "parent.html"
})
export class parent{
@ViewChild{c_Comp} child : c_Comp;
constructor(){}
method(){
this.child.open();
}
loadlist(){ } // Have to call from child component.
}
Child:
import { p_Comp } from 'parent.comp';
@Component({
selector: "child",
templateUrl: "child.html"
})
export class child{
constructor(@Inject(forwardRef(() => parent)) private
_parent:parent ) {}
open() {
this.notifyModel.show();
}
notifyConfirm() {
this._parent.loadlist();
}
}
module.ts
import { parent } from 'parent.comp';
import { child } from 'child.comp';
@NgModule({
declarations: [parent, child],
imports: []
})
export class AppModule { }