I'm using a cordova speech recognition plugin (https://github.com/pbakondy/cordova-plugin-speechrecognition) which the method will return what the user has spoken. However if I console.log(startSpeechRecognition()), the return results will not be executed and it will return as 'undefined'
startSpeechRecognition() {
var options = {
language:'en-US',
showPopup:false
};
this.speechRecognition.startListening(options)
.subscribe(
(results: Array<string>) => {return results},
(onerror: string) => (console.log("Error: "+onerror))
);
}
I've tried another solution (Angular 2: Convert Observable to Promise) by using toPromise() but I still get the same result. Any help is greatly appreciated.