Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Basket with Angular #132

Open
alexleone opened this issue Jan 27, 2015 · 2 comments
Open

Implementing Basket with Angular #132

alexleone opened this issue Jan 27, 2015 · 2 comments
Labels

Comments

@alexleone
Copy link

Has anyone had any experience integrating basket into an angular app?

Currently I am using bower and grunt to configure my build of the app. When I run a build for my app the grunt module use a Gruntfile to go through a series of tasks that take all the JS files concatenates, minifies, and add a cache buster file name.

Now I do not have an experience with Basket.js but I think it would be great to use in my project and was wondering if anyone had an experience with this already?
Or have an idea of how I can integrate basket into the grunt build process.

@lnr0626
Copy link

lnr0626 commented Mar 5, 2015

It's pretty straightforward:

basket.require({url:"<url-to-script>", unique:"cache-buster-string"}, ...).then(function() {
            $(document).ready(function() {
                angular.bootstrap(document, ['app-name']);
            });
        });

^ goes in the page head, and you have to remove the ng-app directive from w/e you currently have it.

Other than having to manually bootstrap angular, the two libraries don't affect each other.

EDIT: You could also just give it a unique file name (which is what it sounds like you are doing), but then it would keep multiple versions of the script in localStorage until each one expires instead of replacing the old version with the new version.

@alexleone
Copy link
Author

Thanks for the response let me try this out.

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

No branches or pull requests

3 participants