Sometimes the code in $timeout does not trigger a digest cyle, did you
manually try using $scope.apply() after the formName is modified in timeout?
On Wednesday, May 20, 2015 at 7:40:02 PM UTC+5:30, Soorya Prakash wrote:
>
> Hi,
> I am having scope variable like *formName* as a json object in parent
> controller and and watching from child controller using $watch. On
> submitting the form i am making the *formName *as null and then again
> assigning the value .But the $watch function was not working and the
> *formName
> *still holds the last assigned value. Like below.
>
>
> In child controller
> $scope.$parent.$watch('*formName*',function (formName){
> }):
>
>
> In parent controler
>
> $scope.formname = null;
> function onSubmit(){
> //after api call
> $scope.formName = null;
> $timeout(function(){
> $scope.formName = (updated data)
> })
> }
>
>
>
--
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.