NativeScript usage of the new HttpClient - causes error?


#1

Currently I have a working app (Groceries app):

Using this app.module.ts file

Where this is how I use the (old) Http module :

(Although it’s working) - Webstorm doesn’t recognize it ( since Http is old):

image

So I’ve changed app.module.ts to use the new HttpClient :

via :

import {HttpClient, HttpHeaders} from "@angular/common/http";

image

  • Then I get this exception :
System.err: Caused by: com.tns.NativeScriptException: 
System.err: Calling js method onActivityResumed failed
System.err: 
System.err: **Error: Trying to link invalid 'this' to a Java object**
System.err: File: "file:///data/data/org.nativescript.Groceries/files/app/tns_modules/tns-core-modules/ui/frame/fragment.transitions.js, line: 266, column: 35
System.err: 
System.err: StackTrace: 

Full error (in console) is here :

Question

How can I fix my code not to show this error ?

Here is the package.json file