Home

Awesome

Angular Snippets for Brackets

A collection of Angular snippets for Brackets editor.

Install

Git Clone

  1. Under main menu select Help > Show Extensions Folder
  2. Git clone this repository inside the folder user.

Extension Manager

  1. Under main menu select File > Extension Manager...
  2. Search for "Angular snippets"
  3. Click "Install"

How to use

  1. Enable Angular Snippets<br/> Under main menu select Edit > Enable Angular Snippets or<br/> open the Preferences File and add "angular-snippets.enabled": true.
  2. Enter a snippet and hit the Tab key.

Snippets list

angular.module('{name}', [])
config([function () {

}])
config(['$routeProvider', function ($routeProvider) {
	$routeProvider.when('/{route}', {
		templateUrl: '{name}.html',
		controller: '{Nane}'
	}).otherwise({ redirectTo: '/{route}' });
}])
when('/{route}', {
	templateUrl: '{name}.html',
	controller: '{Name}'
})
otherwise({ redirectTo: '/{route}' })
run([function () {

}])
controller('{Name}', ['$scope', function ($scope) {

}])
service('{name}', [function () {

}])
factory('{name}', [function () {
	return {

	};
}])
directive('{name}', [function () {
	return {
		restrict: '{A}',
		link: function (scope, element, attrs) {

		}
	};
}])

Directives available options

Directives can be customized at will. Here is a list of all the available options:

NOTE: Options are sperated by commas (,) without spaces.

For example:

directive('directive-name', [function () {
	return {
		restrict: '{A}',
		template: '',
		link: function (scope, element, attrs) {

		}
	};
}]).
directive('directive-name', [function () {
	return {
		restrict: '{A}',
        scope: {},
		template: '',
        transclude: true,
		link: function (scope, element, attrs) {

		}
	};
}])

Snippets combinations

You can combine snippets together like this:

<code>ngmodule.ngconfig[$routeProvider].ngcontroller.ngdirective[scope,template].ngfactory</code> will create snippet:

angular.module('{name}', []).controller('{Name}', ['$scope', function ($scope) {

}]).directive('{name}', [function () {
	return {
		restrict: '{A}',
		scope: {},
		template: '',
		link: function (scope, element, attrs) {

		}
	};
}]).factory('{name}', [function () {
	return {

	};
}]);