Skip to content

Commit ad8c981

Browse files
committed
(docs): Add ng-annotate section to tutorial
1 parent 74bce7e commit ad8c981

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.docs/angular-meteor/client/views/steps/tutorial.step_02.tpl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@ The concept of a scope in Angular is crucial. A scope can be seen as the glue wh
110110

111111
To learn more about Angular scopes, see the [angular scope documentation](https://docs.angularjs.org/api/ng/type/$rootScope.Scope).
112112

113+
# ng-annotate and .ng.js
114+
115+
As you can see, when we declared the controller, we used strings for [dependency annotations](https://docs.angularjs.org/guide/di#dependency-annotation) that avoids minification problems:
116+
117+
angular.module("socially").controller("PartiesListCtrl", ['$scope',
118+
function($scope){
119+
// ...
120+
}]);
121+
122+
There is a very popular Angular tool that's called [ng-annotate](https://github.com/olov/ng-annotate) that takes care of that for us so we can write regular code like it's not
123+
going through minification.
124+
125+
angular-meteor uses that process automatically. all you need to do is to change your .js files endings to .ng.js
126+
127+
then you can write your dependency injection like that:
128+
129+
angular.module("socially").controller("PartiesListCtrl",
130+
function($scope){
131+
// ...
132+
});
113133

114134
# Experiments
115135

0 commit comments

Comments
 (0)