Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

feat: Ctrl with $inject/Ctrl Proto Methods/Ngdocs #8

Merged
merged 2 commits into from
Apr 20, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ $scope.$1 = function($2) {
};
```

##### ngcp
```
$1Ctrl.prototype.$2 = function $2($3) {
$4
};
```

##### ngon
```
$scope.$on('$1', function(event, $2) {
Expand All @@ -410,6 +417,26 @@ var $1 = function($scope, $2) {
}
```

##### ngc$
```
$1Ctrl.$inject = [$scope, '$2'];
function $1Ctrl($scope, $2) {
$4
}
angular.module($3).controller('$1Ctrl', $1Ctrl);
```

##### ngdoc
```
/**
* @ngdoc ${1:function}
* @name $2
* @description
* $3
*
*/
```

##### nghttp
```
$http({method: '${1:GET}', url: '$2'})
Expand Down
27 changes: 27 additions & 0 deletions snippets/js-templates.cson
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@
$3
};
"""
"controller prototype method":
"prefix": "ngcp"
"body": """
$1Ctrl.prototype.$2 = function $2($3) {
$4
};
"""
"$scope.$on":
"prefix": "ngon"
"body": """
Expand All @@ -147,7 +154,27 @@
"body": """
var $1 = function($scope, $2) {
$3
};
"""
"controller $inject Syntax":
"prefix": "ngc$"
"body": """
$1Ctrl.$inject = [$scope, '$2'];
function $1Ctrl($scope, $2) {
$4
}
angular.module($3).controller('$1Ctrl', $1Ctrl);
"""
"ngdocs comment":
"prefix": "ngdoc"
"body": """
/**
* @ngdoc ${1:function}
* @name $2
* @description
* $3
*
*/
"""
"$http":
"prefix": "nghttp"
Expand Down