Zdarvstvuyte.
Created a service which makes set when you press the button
import { Injectable } from '@angular/core'; @Injectable() export class DataService { constructor() { } private data; setData(data) { this.data = data; } getData() { return this.data; } }
in another file when you press button called get this service
this.dataService.getData()
but why data is not updated.... as was empty, and remained, despite the fact that if you call from the console, everything works.....