how do I setup vimeo api with angular2

1.1k views Asked by At

I'm trying to use the https://github.com/vimeo/vimeo.js with my angular2 project. Here is what I've done.

  1. ran 'npm install vimeo'
  2. created 'vimeo.service.ts'
  3. tried to import {Vimeo} from '../../node_modules/vimeo';

At the import line I get an error saying

' [ts] Module '../../node_modules/vimeo' was resolved to '/Users/../GitHub/Angular2-GettingStarted/APM - Final/node_modules/vimeo/index.js', but '--allowJs' is not set'

What am I doing wrong? Is there a working Angular2 example using this api that I could work off of?

Thanks,

1

There are 1 answers

0
Mark Pieszak - Trilon.io On

It's not an es6 library, so try doing a require instead.

const Vimeo = require('vimeo').Vimeo;

// then when initializing it 
const lib   = new Vimeo(CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN);

I haven't used it myself, but it looks like something along those lines would do the trick!