|
|
@@ -1,21 +0,0 @@
|
|
|
-import { Injectable } from '@angular/core';
|
|
|
-import { BehaviorSubject } from 'rxjs';
|
|
|
-
|
|
|
-@Injectable({
|
|
|
- providedIn: 'root',
|
|
|
-})
|
|
|
-export class DatabaseService {
|
|
|
- private dataSubject = new BehaviorSubject<string>('Initial Value');
|
|
|
- public data$ = this.dataSubject.asObservable();
|
|
|
-
|
|
|
- updateData(newValue: string) {
|
|
|
- this.dataSubject.next(newValue);
|
|
|
- }
|
|
|
-
|
|
|
- ngOnInit(): void {
|
|
|
- setTimeout(() => {
|
|
|
- this.updateData('New Value');
|
|
|
- console.log('updated data');
|
|
|
- }, 5000);
|
|
|
- }
|
|
|
-}
|