mendhak / angular-intro.js

AngularJS directives for intro.js
http://code.mendhak.com/angular-intro.js/
GNU Affero General Public License v3.0
503 stars 175 forks source link

It is not compatible in ES6 #143

Open matildayipan opened 7 years ago

matildayipan commented 7 years ago

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 commented 7 years ago

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

simonemazzoni commented 6 years ago

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 commented 6 years ago

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

mendhak commented 6 years ago

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?

simonemazzoni commented 6 years ago

@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.

Louhike commented 5 years ago

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.

xemlock commented 4 years ago

@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.