aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ng/compile.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js
index c7cd08bc..8cc518d5 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -775,7 +775,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
* @param {function(interpolatedValue)} fn Function that will be called whenever
the interpolated value of the attribute changes.
* See the {@link guide/directive#Attributes Directives} guide for more info.
- * @returns {function()} the `fn` parameter.
+ * @returns {function()} Returns a deregistration function for this observer.
*/
$observe: function(key, fn) {
var attrs = this,
@@ -789,7 +789,10 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
fn(attrs[key]);
}
});
- return fn;
+
+ return function() {
+ arrayRemove(listeners, fn);
+ };
}
};