Skip to content

Instantly share code, notes, and snippets.

@reneoelke
Last active August 29, 2015 14:06
Show Gist options
  • Save reneoelke/fa3dc636ea7a4064de81 to your computer and use it in GitHub Desktop.
Save reneoelke/fa3dc636ea7a4064de81 to your computer and use it in GitHub Desktop.
Angular Bookmarklet for Chrome
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...");
}
}
@reneoelke
Copy link
Author

Here are the steps to create this bookmarklet in Chrome:

  1. Open source code in raw mode
  2. If bookmark bar isn't shown then show it with Shift + Cmd + b / Shift + Ctrl + b
  3. Select all the source code with Cmd + a / Ctrl + a
  4. Drag & Drop the selected source code to the bookmark bar
  5. Right click on the new icon, select Edit ... and give it a name like Angular 1.2.23

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);). ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment