I've initialized an array of type string called products
using the Observable
interface as shown below:
products: Observable<string[]>;
Now, I need to add elements to the products
array without using the subscribe method. Unfortunately, the normal push method is not working in this case. Here's the code snippet that's causing an issue:
this.products.push("mova");
Can you suggest an alternative way to add elements to an array without using dependency injection or subscribing methods? Please provide a simple solution.