How can I ensure my Angular 2 app listens to changes in a Firebase table? I am using Angular2, Firebase, and TypeScript, but the listener is not firing when the database table is updated.
I want the listener to always trigger whenever there are updates or changes in the table. It appears that placing the listener in a global location might be necessary as it's currently located in a service file.
This is what I have tried:
this.adminNotifications = new Firebase(_environment.firebaseUrl + "/adminNotifications");
taskSchedulerListener = (): Promise<any> => {
this.adminNotifications.on('value', function(snapshot: any) {
console.log("admin notification hit!");
});
}
Please let me know if you require additional code samples. At the moment, my goal is for the listener to respond when changes occur in the adminNotifications table. Essentially, I want the console.log
method from the snippet above to execute.
No errors appear in the console, but the action does not take place when the adminNotifications table is modified.