Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

subject in angular service file

import { Injectable } from '@angular/core';  
import { Subject } from 'rxjs';  
  
@Injectable({  
  providedIn: 'root'  
})  
export class DataSharingService {  
  
  SharingData = new Subject();  
  constructor() { }  
}  

//use this service in three different component using subject:give the same output for all fields
 
PREVIOUS NEXT
Tagged: #subject #angular #service #file
ADD COMMENT
Topic
Name
7+9 =