AngularInject
Convenient Sublime Text 2 Plugin to quickly inject a dependency into any AngularJS module
Details
Installs
- Total 18K
- Win 10K
- Mac 5K
- Linux 3K
Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Sublime Text 2 Plugin : AngularInject
Convenient Sublime Text 2 Plugin to quickly inject a dependency into any AngularJS module
Installation
With Package Control:
Just search for AngularInject package and confirm. Tada !
Manually:
Download and extract into your ST2 Packages folder. That's it.
This directory can be found on Mac OS at ~/Library/Application Support/Sublime Text 2/Packages/
Usage
Note: this plugin only work (yet) with inline annotation. It doesn't work (yet) with static injection (example: MyController.$inject = ['$scope', 'greeter'];
).
By default the plugin can be called with Cmd + Alt + i
(Mac OS) and Ctrl + Alt + i
(Windows & Linux).
You can also use the Command Palette to find AngularJS: Inject Dependency
(any word should work).
You should see the quick panel (bottom of ST2 screen). Just type in the dependency you wish (for instance $window). Shazam !
Your module should looks like this :
angular.module('myApp.controllers', []).controller('MyCtrl', [ '$http', function($http) { ... }
and to something like this after the plugin action (notice the $window injection)
angular.module('myApp.controllers', []).controller('MyCtrl', [ '$http', '$window', function($http, $window) { ... }
If multiple modules exist on the same file, you will be ask to chose the one to inject.
Next Step
Know issues
A lot ?
Todo
- Allow to remove an injection from the module
- Make the plugin work with no min-safe version (
MyCtrl.$inject[…]
orcontroller('MyCtrl', function()…
)3. inject) - Insure that the modified line is really the [ function() from the module
Contributing
Feel free to modify, share, comment any bug or fork. Just drop a tweet if you do !