georapbox / brackets-angular-snippets

A collection of AngularJS snippets for Brackets.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Snippets list

  • ngmodule =>
angular.module('{name}', [])
  • ngconfig =>
config([function () {

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

}])
  • ngcontroller =>
controller('{Name}', ['$scope', function ($scope) {

}])
  • ngservice =>
service('{name}', [function () {

}])
  • ngfactory =>
factory('{name}', [function () {
	return {

	};
}])
  • ngdirective =>
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:

  • scope
  • template
  • templateUrl
  • transclude

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

For example:

  • ngdirective[template] will create snippet:
directive('directive-name', [function () {
	return {
		restrict: '{A}',
		template: '',
		link: function (scope, element, attrs) {

		}
	};
}]).
  • ngdirective[scope,template,transclude] will create snippet:
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:

ngmodule.ngconfig[$routeProvider].ngcontroller.ngdirective[scope,template].ngfactory 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 {

	};
}]);

About

A collection of AngularJS snippets for Brackets.

License:MIT License


Languages

Language:JavaScript 95.5%Language:CSS 4.5%