Last active
August 29, 2015 14:06
-
-
Save reneoelke/fa3dc636ea7a4064de81 to your computer and use it in GitHub Desktop.
Angular Bookmarklet for Chrome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: | |
var angularVersion = "1.2.23"; | |
if (typeof(angular) == "undefined") { | |
var angularScript = document.createElement('script'); | |
angularScript.type = "text/javascript"; | |
angularScript.src = "//ajax.googleapis.com/ajax/libs/angularjs/" + angularVersion + "/angular.min.js"; | |
angularScript.onload = function() { | |
console.log("AngularJS " + angular.version.full + " loaded successfully."); | |
}; | |
angularScript.onerror = function() { | |
delete angular; | |
console.error("Error while loading AngularJS!"); | |
}; | |
document.getElementsByTagName('head')[0].appendChild(angularScript); | |
} else { | |
if (typeof(angular) == "object") { | |
console.info("AngularJS (" + angular.version.full + ") is already loaded!"); | |
} else { | |
console.info("AngularJS is already loading..."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here are the steps to create this bookmarklet in Chrome:
Ready. Just open the javascript console with Alt + Cmd + j / Alt + Ctrl + j, click on the bookmarklet and have fun (i.e.
angular.bootstrap(document);
). ;-)