I tried using apply after the formName modification but still not working, 
when i keep it as $rootScope it is working fine.

On Wednesday, May 20, 2015 at 8:49:39 PM UTC+5:30, Vikas Kulkarni wrote:
>
> 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 angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to