COMPONENTS CONTROL OTHER COMPONENTS

PHOTO EMBED

Tue Nov 01 2022 18:22:08 GMT+0000 (Coordinated Universal Time)

Saved by @chicovirabrikin

service:
import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';

@Injectable({
  providedIn: 'root'
})
export class PerfilService {


  private subject = new Subject<any>();
  bot: any;

  getOutEditPerson() {
    this.subject.next('');
  }

  getgetOutEditPerson(): Observable<any> {
    return this.subject.asObservable();
  }
}

ts envia:

constructor(
  private perfilService: PerfilService,
)

setClose() {
  this.perfilService.getOutEditWork();
}

ts recebe:
changeSubscriptionWork: Subscription;
constructor(
  private perfilService: PerfilService,
) {
  this.changeSubscriptionWork = this.perfilService.getgetOutEditPerson().subscribe(() => {
    this.logoutbtn = true;
    this.geralzone = true;
  });
}
content_copyCOPY