0

I am trying manipulate JSON objects in a android project using NativeScript and Angular2, but, I can't add the reference to JSOG.js.

First, I run the command npm install jsog --savein prompt (Windows). Then, I put reference in file. I tried put the path in many ways, but, the error is "Cannot find modules".

File home.ts

import jsog = require("./../../node_modules/jsog/lib/JSOG.js");

Path to JSOG.ts

Fernanda
  • 13
  • 4

2 Answers2

1

If you use SystemJS, you could try something like that:

System.import('./../../node_modules/jsog/lib/JSOG.js').then(loadedScript=> {
  loadedScript.someMethod();
}

Hope it helps you, Thierry

Thierry Templier
  • 198,364
  • 44
  • 396
  • 360
  • Thanks, Thierry. That's similar to the problem I ran into when trying to dynamically load JSOG.js in this project. I can't import SystemJS to the project after install by npm. I will continue searching by answer. – Fernanda Dec 28 '15 at 16:47
1

In order to import JSOG.js, you will a d.ts file for it. You can write it yourself or try to find it from somewhere else.

Another thing that you can do is to import it in the following way:

var jsog = require("jsog");

Then you can use it as object. The drawback is that there won't be any intellisense.

Neli Chakarova
  • 660
  • 1
  • 5
  • 18