I used the data service to set the value on a onclick event new tab opens 
up and subscribe in the child i.e and pop up tab , However the data service 
returning value as in defined.
what is that I am missing, Your response is highly appreciated.


@Injectable()

*export* *class* DataService {

*private* selectedCustomer: Subject<CustomerLoginVo> = *new* BehaviorSubject
<CustomerLoginVo>(*null*);

customerClickedOn = *this*.selectedCustomer.asObservable();

*private* selectedOrders: Subject<OrderItemVo[]> = *new* BehaviorSubject<
OrderItemVo[]>(*null*);

selectedCustomerOrders = *this*.selectedOrders.asObservable();

*constructor*() { }

setSelectedCustomer(customerSelected: CustomerLoginVo) {

*this*.selectedCustomer.next(customerSelected);

}

setOrders(orders: OrderItemVo[]) {

*this*.selectedOrders.next(orders);

}

}

-----------------------------------------------------


This is the parent component setting the value

*this*.dataService.setOrders(*this*.orders);


-------------------------------------------------------------


This is in the pop up component


ngOnInit() {


console.log ('On Init in Print is called');


*this*.getOrders();


console.log ('On init Print is called'*+t**his*.orders);



}




ngOnChanges() {


console.log ('On Changes in Print is called');


*this*.getOrders();


console.log ('On Changes in Print is called'*+t**his*.orders);





}


  getOrders() {


*this*.customerInfoDataService.selectedCustomerOrders.subscribe(customerOrders 
=> {


*this*.orders = customerOrders;

console.log ('getOrders is called'*+c*ustomerOrders);


}, err => {



console.log(err);


});


}






-----------------------------------------------------


Please let me know you response.

-----------------------------------------------------

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to