1

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

Rahul Matte
  • 1,151
  • 2
  • 23
  • 54

1 Answers1

1

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)

Community
  • 1
  • 1
Grenther
  • 476
  • 3
  • 10