Hi All,

I have three models startDate,endDate,durationMillis in scope. If any of
the value is changed by use, I need to calculate the other model by $watch.

$scope.$watch('startDate', function(){
    $scope.endDate = new Date($scope.startDate.getTime() +
$scope.durationMillis);});

$scope.$watch('endDate', function(){
    $scope.durationMillis = $scope.endDate.getTime() +
$scope.startDate.getTime();});

$scope.$watch('durationMillis', function(){
    $scope.startDate = new Date($scope.endDate.getTime() -
$scope.durationMillis.getTime());});

Here, my problem is when user changes start date/end date/duration, $watch
of calculated attributes(not changed by user) has been called recursively.

Please give a solution to stop other watches when calculating the value.


Thanks and Regards

Ramaraj K

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to