Skip to content
This repository has been archived by the owner on Oct 1, 2023. It is now read-only.

Using angular-spinner with requirejs custom config #61

Closed
lripo opened this issue Sep 21, 2015 · 6 comments · Fixed by #63
Closed

Using angular-spinner with requirejs custom config #61

lripo opened this issue Sep 21, 2015 · 6 comments · Fixed by #63

Comments

@lripo
Copy link
Contributor

lripo commented Sep 21, 2015

I'm using requirejs to load angular and angular-spinner and I cannot use a custom path configuration. I think that it's because it's required under the name 'spin.js' (using a dot) in the line 116: define(['angular', 'spin.js'], factory);
I'm not an expert using requirejs, but it seems that names with dots cannot be aliased. I'm trying to use a config like this:

require.config({
    appDir: '',
    baseUrl: './js',
    paths: {
        'angular': '../vendor/angular/angular.min',
        'spin.js': '../vendor/spin.js/spin.min'
    }
 });

But it does not work. If I just change line 116 to define(['angular', 'spin'], factory);, and then configure my path as 'spin': '../vendor/spin.js/spin.min', then everything works at expected.

What do you think? Should it be changed?

@k7sleeper
Copy link
Contributor

We have the same issue. Until v0.6.x we worked successfully with

require.config({
    baseUrl: './app',
    paths: {
        'angular': '../vendor/angular/angular.min',
        'spin': '../vendor/spin.js/spin.min'
    }
 });

After updating to v0.7.0 the browser tries to load /spin.js instead of /vendor/spin.js/spin.min.js. Changing require config to

require.config({
    baseUrl: './app',
    paths: {
        'angular': '../vendor/angular/angular.min',
        'spin.js': '../vendor/spin.js/spin.min'
    }
 });

does not change anything.
Changing line 116 to define(['angular', 'spin'], factory) works with the 'old' require config.

I guess if you require something which ends with .js, require ignores any path mappings. That may be a bug or a feature in require, I dont know ...

@lripo
Copy link
Contributor Author

lripo commented Oct 1, 2015

I've just sent a pull request #63

@urish urish closed this as completed in #63 Oct 1, 2015
@urish
Copy link
Owner

urish commented Oct 1, 2015

Can you please check if the following version does the trick for you?

https://github.com/urish/angular-spinner/blob/5b662876e815c484bda1b4ee8e96e7d9ecbaafad/angular-spinner.js

Thanks!

@k7sleeper
Copy link
Contributor

It works!

Thank you very much!

@urish
Copy link
Owner

urish commented Oct 2, 2015

Excellent, thanks for the feedback!

@lripo
Copy link
Contributor Author

lripo commented Oct 2, 2015

Yes, it works! Thanks a lot!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants