139
139
*/
140
140
141
141
142
+ /**
143
+ * @ngdoc service
144
+ * @name angular.module.ng.$compileProvider
145
+ * @function
146
+ *
147
+ * @description
148
+ *
149
+ */
142
150
$CompileProvider . $inject = [ '$provide' ] ;
143
151
function $CompileProvider ( $provide ) {
144
152
var hasDirectives = { } ,
@@ -148,7 +156,21 @@ function $CompileProvider($provide) {
148
156
MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ' ;
149
157
150
158
151
- this . directive = function registerDirective ( name , directiveFactory ) {
159
+ /**
160
+ * @ngdoc function
161
+ * @name angular.module.ng.$compileProvider.directive
162
+ * @methodOf angular.module.ng.$compileProvider
163
+ * @function
164
+ *
165
+ * @description
166
+ * Register directives with the compiler.
167
+ *
168
+ * @param {string } name Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
169
+ * <code>ng-bind</code>).
170
+ * @param {function } directiveFactory An injectable directive factroy function. See {@link guide/directive} for more
171
+ * info.
172
+ */
173
+ this . directive = function registerDirective ( name , directiveFactory ) {
152
174
if ( isString ( name ) ) {
153
175
assertArg ( directiveFactory , 'directive' ) ;
154
176
if ( ! hasDirectives . hasOwnProperty ( name ) ) {
@@ -295,12 +317,14 @@ function $CompileProvider($provide) {
295
317
*
296
318
* @param {string } key Normalized key. (ie ngAttribute) .
297
319
* @param {function(*) } fn Function that will be called whenever the attribute value changes.
320
+ * @returns {function(*) } the `fn` Function passed in.
298
321
*/
299
322
$observe : function ( key , fn ) {
300
323
// keep only observers for interpolated attrs
301
324
if ( this . $$observers [ key ] ) {
302
325
this . $$observers [ key ] . push ( fn ) ;
303
326
}
327
+ return fn ;
304
328
}
305
329
} ;
306
330
0 commit comments