Hi Alian,

flag and fflag are the values which i am taking from the controller and i
am using those values in directive for DOM manupulation

On Sat, Jun 13, 2015 at 12:33 PM, Luke Kende <[email protected]> wrote:

> Yeah, this is hard to decrypt.  You might want to use a plunkr to
> illustrate. That said... it be easier to have separate watches and a new
> local variable to know the difference.
>
>  directive.link = function($scope, element, attributes) {
>     var makepubpriHidden = false;
>
>     $scope.$watch('flag',function(newVal){
>         console.log("newVal----"+newVal);
>         if(newVal==false){
>             $(".makepubpri").hide();
>             makepubpriHidden = true;
>         }else{
>             $(".makepubpri").show();
>             makepubpriHidden = true;
>         }
>
>       })
>     };
>
> $scope.$watch('fflag',function(newValue){
>    console.log("flag1 value----"+newValue)
>    if(newValue==202 && makepubpriHidden){
>       $(".hidemain").hide();
>       console.log("is it coming in 202------")
>    }else{
>       $(".hidemain").show();
>    }
> })
>
> On Friday, June 12, 2015 at 1:08:47 AM UTC-6, Kiran A wrote:
>>
>>
>> i want to hide element based on the flag value.
>>
>> i am not able to hide   <span class="hidemain">Email ID<b>:</b>
>> {{userprofile.useremail}} </span>
>> element even if fflag==202
>>
>>
>>
>>
>> corp.directive('pubpri',function(){
>>     console.log("is this pubpri is called------");
>>     var directive = {};
>>     directive.restrict = 'A';
>>
>>     directive.scope = {
>>             flag : '=flag',
>>             fflag : '=fflag'
>>     }
>>
>>     directive.link = function($scope, element, attributes) {
>>     $scope.$watch('flag',function(newVal){
>>         console.log("newVal----"+newVal);
>>         if(newVal==false){
>>             $(".makepubpri").hide();
>>              $scope.$watch('fflag',function(newValue){
>>                  console.log("flag1 value----"+newValue)
>>                  if(newValue==202){
>>                      $(".hidemain").hide();
>>                      console.log("is it coming in 202------")
>>                  }else{
>>                      $(".hidemain").show();
>>                  }
>>              })
>>         }else{
>>             $(".makepubpri").show();
>>         }
>>
>>       })
>>     };
>>     return directive;
>> });
>>
>>
>> <div pubpri flag="userprofile.result" fflag="userprofile.pubpriEmail">
>>                                                     <span
>> class="hidemain">Email ID<b>:</b> {{userprofile.useremail}} </span>
>>                                                         <div
>> class="makepubpri">
>>                                                             <label
>> class="label-radio inline" style="padding-left: 850px ! important;">
>>                                                             <input
>> type="radio" name="pubpriemail" ng-model="userprofile.pubpriEmail"
>> value="201" >
>>                                                             <span
>> class="custom-radio"></span>
>>                                                                 Public
>>                                                             </label>
>>                                                             <label
>> class="label-radio inline">
>>                                                             <input
>> type="radio" name="pubpriemail" ng-model="userprofile.pubpriEmail"
>> value="202">
>>                                                             <span
>> class="custom-radio"></span>
>>                                                                 Private
>>                                                             </label>
>>                                                         </div>
>>                                                     <div>
>>
>  --
> 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.
>



-- 
Thanks and Regards,
*Kiran A*

-- 
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