angular-intro.js icon indicating copy to clipboard operation
angular-intro.js copied to clipboard

It is not compatible in ES6

Open matildayipan opened this issue 8 years ago • 7 comments
trafficstars

This project is code in Angular 1.5 in ES6, so it is compiled with Babel by using Webpack. In app.js, I have tried to import or require this package, then dependency injection this module. Compiling is fine. Once this application start running, it will end up in error due to : Failed to instantiate module, which is angular intro.

Version: "angular-intro.js": "^3.2.5", "intro.js": "^2.5.0",

In app.js

import '../node_modules/intro.js/intro.js';
const ngIntro = require('../node_modules/angular-intro.js/bower_components/intro.js/intro.js');

-- OR ---

Import ngIntro from '../node_modules/angular-intro.js/bower_components/intro.js/intro.js'

Then

var myApp = angular.module('myApp', [ngIntro.name]);

Help, please

matildayipan avatar Jul 21 '17 01:07 matildayipan

@mendhak do you have any idea ? Help, please ...

matildayipan avatar Jul 24 '17 01:07 matildayipan

Same for me.

Notice that in my case at this line root is an empty object, so root.angular and root.introJs are undefined too.

Old version 2.1.3 works just fine, but it hasn't the service which I need.

simonemazzoni avatar Dec 20 '17 12:12 simonemazzoni

@mendhak are you still following this project? I could use some help to understand why the last version doesn't work in my project.

simonemazzoni avatar Jan 08 '18 11:01 simonemazzoni

Sorry, I've not been following this very well.
Unfortunately I'm not very familiar with ES6 so I don't think I can be of much help; but I could try fiddling around with a sample project if you already have one?

mendhak avatar Jan 09 '18 21:01 mendhak

@mendhak, my problems starts with the introduction of typescript. I don't know exactly why, but it looks like something bother the ES6 import function.

simonemazzoni avatar Jan 10 '18 11:01 simonemazzoni

It's an old thread but for the record: import 'angular-intro.js'; worked for me but the library had a problem with the require() for intro.js then. I had an error saying that introJs was not a function (or b if the file is minified). I had to change the following initialization: function NgIntroService() { this.intro = introJs(); } by function NgIntroService() { this.intro = introJs.introJs(); }

I do not consider this a good solution. It's just that I lack experience for this and I had to make it work real quick for a demo. If I come up with a better way, I'll add a new answer.

Louhike avatar Jun 19 '19 16:06 Louhike

@Louhike That's almost exactly how it was handled in versions prior to 3.2.1. Skipping this in later versions made the package unusable with Webpack / TypeScript.

xemlock avatar Sep 19 '19 09:09 xemlock