Awesome
Angular Snippets for Brackets
A collection of Angular snippets for Brackets editor.
Install
Git Clone
- Under main menu select Help > Show Extensions Folder
- Git clone this repository inside the folder user.
Extension Manager
- Under main menu select File > Extension Manager...
- Search for "Angular snippets"
- Click "Install"
How to use
- Enable Angular Snippets<br/> Under main menu select Edit > Enable Angular Snippets or<br/> open the Preferences File and add "angular-snippets.enabled": true.
- 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:
- <code>ngdirective[template]</code> will create snippet:
directive('directive-name', [function () {
return {
restrict: '{A}',
template: '',
link: function (scope, element, attrs) {
}
};
}]).
- <code>ngdirective[scope,template,transclude]</code> 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:
<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 {
};
}]);