urish / angular-load Goto Github PK
View Code? Open in Web Editor NEWDynamically load scripts and css stylesheets in your Angular.JS app
License: MIT License
Dynamically load scripts and css stylesheets in your Angular.JS app
License: MIT License
The latest code reuses promises, saving similar logic in the app... Any chance you could do a release? :)
How to use with ui router?
Thanks
Is there a planned release for 0.4.2? I'd like to use unloadCSS but it's not available in 0.4.1, the last release available on github and bower.
Recurly init doen't work.
Hi, I am in a situation where I need to either force a reload of a script, or unload and load it again.
Is there a way to add this?
Hi,
Thanks for your great library.
Would it be possible to supply a typescript definition file for this library?
This would be great ๐
There is currently a repository of definition files at:
https://github.com/DefinitelyTyped/DefinitelyTyped
Thanks,
David
Would be nice to be able to remove scripts from the DOM once the page/url changes. This way the DOM doesn't end up with a ton of script tags. Don't think this is a huge performance concern, just a nice feature.
I am proposing changing the module name from "urish.load" to something more meaningful. When I look back at my app dependencies I am unclear about what "urish.load" is at first glance, something more fitting like "angular.load" or "angularLoad" would be a better solution.
Hello! Thanks for this module!
I'm just curious, you are using onload
event in order to detect when script or stylesheet loads. Is it compatible with all current platforms/browsers?
I've just read a very comprehensive article of how it is difficult to detect when external resource is loaded in a cross-platform way and was surprised that you are using such a straightforward approach. Can you elaborate please? Thanks!
Got error when installing via bower. I think the error is caused by:
dependencies: {
angular: '>=1.0.0 <1.6.0'
Could you please confirm?
While working on GlobaLeaks, we found out that It would be valuable to implement an integration with SauceLabs in order to perform end-to-end testing in the cloud testing against cross-browser compatibility.
Given the fact that angular-load is using Grunt, this would be really simple by using grunt-protractor-runner
Today vendors are versioned...
var attrs = {
id: 'dropboxjs',
dataset: {
appKey: 'dropbox_app_key'
}
};
angularLoad.loadScript('https://www.dropbox.com/static/api/2/dropins.js', attrs).then(function () {
Dropbox.choose(..);
});
And the created element would contain:
<script src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="dropbox_app_key"></script>
Those attributes are mandatory to load dropbox js api. If you think this is worth I can make a PR.
Hi
is it possible to chain several loads of scripts or cas ?
I'm using anuglar-load to load the SlidingMarker API after my google maps API has loaded asycnohornly in an angular controller. https://github.com/terikon/marker-animate-unobtrusive#api
This does not throw an error but when I try to use the plugin in the controller I get a ReferenceError. Interestly, I can call new SlidingMarker inside the chrome developer console without any issues.
ionic.bundle.js:26771 ReferenceError: SlidingMarker is not defined
var marker = new SlidingMarker({
position: myLatlng,
map: map,
title: "I'm sliding marker",
duration: 2000,
easing: "easeOutExpo"
});
IS there some scoping issue going on here?
After testing my website on google page speed insight I decided to use angular-load to remove the render blocking CSS.
However, even when I am using angular-load, google still detects render blocking css.
Is this really making css load asynchronously?
Here is a snipet of my code:
$stateProvider
.state('main', {
url: '/',
abstract: true,
templateUrl: 'main/main.html',
controller: 'MainCtrl',
resolve:{
load: ['angularLoad', function(angularLoad){
return angularLoad.loadCSS('<%= asset_path "normalApp.css" %>')
}]
}
})
When updating angular to 1.6.0, angular-load does not have a compatible version.
Here is the angular 1.6.0 changelog: https://github.com/angular/angular.js/blob/master/CHANGELOG.md
I ran into an issue during a bower install that had some conflicts. I don't believe it's necessary to limit this module to less then 1.6.0
I tested the angularLoad service code in my current AngularJS 1.6.5 project by creating a new service and copying/pasting your code into it. The loadScript functions works wonderfully in 1.6.5
I'm assuming, you can remove the restriction from the bower.json file, as this module and service should function normally on 1.6.x
Maybe I'm wrong? I haven't tested any of the other functions (all I needed was the loadScript).
The code in question:
"dependencies": {
ย "angular": ">=1.0.0 <1.6.0"
},
Change too:
"dependencies": {
ย "angular": ">=1.0.0"
},
I can submit a PR if you wish.... just let me know
It has just been released, would be great to use angular-load with it.
loadCSS()
and unloadCss()
use different naming conventions.
I suggest changing unloadCss()
to unloadCSS()
to follow the same convention and avoid confusion, or vice versa.
Hello!
The ability to unload the CSS files would be great )
I just installed angular-load through bower and got a warning message:
bower angular-load#* invalid-meta angular-load is missing "ignore" entry in bower.json
The complete output was as follows
bower angular-load#* not-cached git://github.com/urish/angular-load.git#*
bower angular-load#* resolve git://github.com/urish/angular-load.git#*
bower angular-load#* download https://github.com/urish/angular-load/archive/0.4.0.tar.gz
bower angular-load#* extract archive.tar.gz
bower angular-load#* invalid-meta angular-load is missing "ignore" entry in bower.json
bower angular-load#* resolved git://github.com/urish/angular-load.git#0.4.0
bower angular-load#~0.4.0 install angular-load#0.4.0
Using bower 1.6.7.
This library is neat. But I have a question - how do I use the services inside a newly loaded angular file? They don't seem to be available for injection. thoughts?
Hello,
Thank you for this great plugin!
I am facing a weird issue and unable to detect its source. I hope you could help.
However, I get the following error when reloading the HTML page:
"Unknown provider: angularLoadProvider <- angularLoad <- AsyncLoadService"
Could you please advise?
Regards,
This project needs some love, and I can no longer find the time required to maintain it. If anybody wants to stand up as a new maintainer, please comment here. Thanks!
To ensure IE 8 compatibility, one must change the line https://github.com/urish/angular-load/blob/master/angular-load.js#L61 by :
var ua = $window.navigator.userAgent.toLowerCase();
if (ua.indexOf('msie 8') != -1){
document.getElementsByTagName('head')[0].appendChild(style);
} else {
$document[0].head.appendChild(style);
}
I hope it will help !
Hello!
As far as I can see, this service will add any specified resource every time the method is called, even if that resource was already added.
Maybe we should ignore "duplicate" calls and just fire the promise immediately?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.