Angular - wait for this variable to have value and then execute
问题 In ngOnInit() , first line of code fetches the value from local storage and then that value is used to filter data from database. Both executes together and I don't get the result. How can I do something like the second function waits for the first one to get value. Below is my ts code: ngOnInit() { //get id of user this.storage.get('loggedInUser').then((val) => { console.log('Your user ID is', val); this.loggedInusr = val; }); firebase.firestore().collection(`todos`) .where("assignTo", "==",