The Notifier component
We can set the default values for the form controls inside the Notifier component, but ideally we need a mechanism that loads the configuration settings for the notifier template from a database. That means when we update the settings inside the notifier page to something like notify me via email about the news with ranks higher than 7
, then we need to save this settings somewhere to make sure the next time we open the application we won't roll back to the default settings.
That sounds like posting a JSON object to the Firebase database. The JSON object can be defined as follows:
'notifier-config': { 'notify' :'true', 'notifier' :'email', 'threshold':'medium rated' }
So let's start by defining the default values. Although we can hard code them inside the Notifier component itself, the best practice is to create an independent class and export it. So create a new TypeScript class named notifier.config.ts
and construct the properties as follows:
// src/app...