Skip to content

Commit 2668578

Browse files
butchpeterspetebacondarwin
authored andcommitted
docs(Attributes): add missing documentation for $observe method
- Add proper ngdoc annotations to existing $observe documentation - Add link to directive guide for usage example of $observe - Add note about $observe function parameter signature Closes angular#3957
1 parent d63a50c commit 2668578

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/ng/compile.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,21 @@ function $CompileProvider($provide) {
418418

419419

420420
/**
421+
* @ngdoc function
422+
* @name ng.$compile.directive.Attributes#$observe
423+
* @methodOf ng.$compile.directive.Attributes
424+
* @function
425+
*
426+
* @description
421427
* Observe an interpolated attribute.
422428
* The observer will never be called, if given attribute is not interpolated.
429+
* The interpolated value of the attribute is passed to the observer function.
423430
*
424431
* @param {string} key Normalized key. (ie ngAttribute) .
425-
* @param {function(*)} fn Function that will be called whenever the attribute value changes.
426-
* @returns {function(*)} the `fn` Function passed in.
432+
* @param {function(interpolatedValue)} fn Function that will be called whenever
433+
the interpolated value of the attribute changes.
434+
* See the {@link guide/directive#Attributes Directives} guide for more info.
435+
* @returns {function()} the `fn` parameter.
427436
*/
428437
$observe: function(key, fn) {
429438
var attrs = this,

0 commit comments

Comments
 (0)