Awesome q2a theme

Why not updated?

0 like 0 dislike
27 views
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.....
by | 27 views

1 Answer

0 like 0 dislike
... private _data: <TYPE>; set Data(data): void { this.data = data; } get Data(): <TYPE> { return this.data; } ...


Cause for example like this:
this.dataService.data
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked Apr 14, 2019 by givemoneybiatch
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users