Issue
I am trying to call Angular 5 function from my Abdroid WebView.
In Android
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT){
this.mWebView.evaluateJavascript("fooBar();", null);
} else {
this.mWebView.loadUrl("fooBar();");
}
In my Angular component I have added fooBar function
In Angular Component
fooBar=function(){
console.log("fooBar");
}
But above code throws
Error
VM772:1 Uncaught ReferenceError: fooBar is not defined at <anonymous>:1:1
Could anyone help me on How to call Typescript function from Android Webview
Solution
See How do expose angular 2 methods publicly?
I don't know why you would do this, in your android webview. Maybe reevaluate that decision, tho I don't know the specifics. (would comment but can't)
Answered By - Grenther
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.