Im trying to call a method from inside of subscribe in angular/ionic. But its not working. Here is my code:
somemethod()
{
const browser = this.iab.create('https://someurl.com');
browser.on('loadstart').subscribe(event=>{
if(event.url === 'https://specificurl.com'){
browser.close();
// trying to call a member method from here , working
this.mymethod();
}
});
browser.on('exit').subscribe(eventx=>{
// trying to call a member method from here
this.mymethod();
});
}
mymethod()
{
http.get<any>(url).subscribe(e=> {
this.myvar = e.response; // this data is shown to user, but the user interface is not changing until something is clicked by the user
});
}
Just in case... You create the in app browser for url
https://someurl.combut you subscribe and check forhttps://specificurl.com. What if you change it to listen for what you create?If the block itself is reachable go over the scope. Example:
Then use
response$like so:https://stackblitz.com/edit/ionic-p5qfps?file=app%2Fapp.component.ts