I am passing values from one component to another component having dynamic form but in that component , value is not being received. I am not getting if I am doing anything wrong in passing values to dynamic forms or is this not the way dynamic forms can receive the value.
I have not pasted whole code otherwise it will be too big, so I have mentioned only relevant pieces of code. Please let me know if any more clarification is required.
In AdminService , this is service class where subject is defined as below:
startedEditingItem=new Subject<string>();
In ProductItemsComponent , value is sent as below to another component.
onEdit(index:number){
console.log("on edit"+this.productId+":"+this.childProductId+":"+index)// This is being printed , so value is sent
this.adminService.startedEditingItem.next(this.productId+":"+this.childProductId+":"+index);}
In ItemEditComponent , value is subscribed as below
ngOnInit() {
console.log("edit item on init") // printed on console
this.subscription=this.adminService.startedEditingItem.subscribe(
(id:string)=>{
console.log("edit item>"+id); // not printed on console.so value is not received
this.initForm();});
this.initForm();}