ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Angular​Inject

by ayamflow ST2

Convenient Sublime Text 2 Plugin to quickly inject a dependency into any AngularJS module

Details

  • 1.1.3
  • github.​com
  • github.​com
  • 11 years ago
  • 34 minutes ago
  • 11 years ago

Installs

  • Total 18K
  • Win 10K
  • Mac 5K
  • Linux 3K
Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13
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

  1. Allow to remove an injection from the module
  2. Make the plugin work with no min-safe version (MyCtrl.$inject[…] or controller('MyCtrl', function()…)3. inject)
  3. 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 !