Load javascript file in component


#1

I need to load dynamically a javascript file in a component this is my example working well in angular2

var Locomote = require(’./assets/js/locomote.min.js’);

@Component({
selector: ‘la-player’,
templateUrl: ‘la-player.html’
})
export class LaPlayerComponent implements AfterViewInit, OnDestroy, DoCheck {

private locomote;
ngAfterViewInit() {
    this.locomote = new Locomote(this.id, 'assets/vendors/locomote/swf/Player.swf');
}

in this case I load with require the javascript file and then call the consturcutor in ngAfterViewerInit, but on ionic2 I got the error
la-player.component.js:11Uncaught Error: Cannot find module "lcomote.min.js"(…)
I don’t know how can I do this with ionic2?

Some ideas?