Importing google vrview as a module

Hey guys, I’m kinda new to ionic2 & and angular2 and been playing with it for one week…

I’m trying to import google-vrview onto a Page component, the objective is to embed a vrview of a 360º photo, the repo is this one:

I’ve tried in two ways:
following this https://ionicframework.com/docs/v2/resources/third-party-libs/
npm install vrview --save

Couldn’t import it this way

And downloading directly from the repo and put it under /src/assets/lib/vrview

On the page.ts i did the import:
import vrview from ‘…/…/assets/lib/vrview/build/vrview.js’;

Here the import works, (i guess), but when i call ionViewDidLoad() like this…

ionViewDidLoad() {
var v = new vrview.Player(’#vrview’, {
image: ‘…/photos/poi1_day.jpg’,
width: ‘100%’,
height: 600,
});
}

…the view returns to the rootPage.

My question is, am I doing this correctly or is there anything I’m doing wrong?

Also, npm install @types/vrview --save doesn’t work, my guess is that isn’t any source for the typings…

1 Like