From 39f4a776d6033fae384c7eb10e2f9f0f5e6971e2 Mon Sep 17 00:00:00 2001 From: Jeremy Wilken Date: Fri, 17 May 2013 09:55:22 -0500 Subject: doc(guide:$location): fix example for two way databinding. When you are watching the $location.path(), it has to be wrapped in a function since it is not attached to the scope and if you pass a string to $scope.$watch it is evaluated against the $scope. --- .../guide/dev_guide.services.$location.ngdoc | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'docs/content/guide/dev_guide.services.$location.ngdoc') diff --git a/docs/content/guide/dev_guide.services.$location.ngdoc b/docs/content/guide/dev_guide.services.$location.ngdoc index 788fe9a7..027a2332 100644 --- a/docs/content/guide/dev_guide.services.$location.ngdoc +++ b/docs/content/guide/dev_guide.services.$location.ngdoc @@ -619,21 +619,25 @@ to the $location object (using {@link api/ng.directive:input.text ngModel} directive on an input field), you will need to specify an extra model property (e.g. `locationPath`) with two watchers which push $location updates in both directions. For example: -
- - --
-// js - controller
-$scope.$watch('locationPath', function(path) {
- $location.path(path);
-});
-
-$scope.$watch('$location.path()', function(path) {
- scope.locationPath = path;
-});
-
-
+