athira
athira

Reputation: 233

ng hide issues in angular js

I have hided an element using ng-hide. Then tried to show it using a function. but it is not showing..

 <input type="button" class="btn btn-primary btn-sm margin-right-15 ng-hide" value=" Edits "
                       ng-click="EditValueSalComponent(T,p,K)" id="{{'in'+T.id}}"/>

<div ng-if="(p.id == K.emp_id && T.id == K.component_id)"> 
  {{K.amount}}
   <div  ng-init="hideinputbox(T.id)"></div>
</div>



 $scope.hideinputbox = function (k) { 
 $("input#in" +k).show();
 }

Upvotes: 0

Views: 45

Answers (2)

km1882
km1882

Reputation: 750

I totally agree with the answer provided by @anik, but just to add on. Whenever you are performing an operation out of the context of angular (via a 3rd party lib or framework like jQuery). The scope values would not be updated as the digest cycle is not triggered . Thats why it is important that you always stay within the angulars execution context.

Upvotes: 0

Anik Islam Abhi
Anik Islam Abhi

Reputation: 25352

You have to do it angular way .

Like this

<input type="button" ng-hide="T.hideMe" class="btn btn-primary btn-sm margin-right-15" value=" Edits "
                       ng-click="EditValueSalComponent(T,p,K)" id="{{'in'+T.id}}"/>
<div  ng-init="hideinputbox(T)"></div>

JS

$scope.hideinputbox = function (k) { 
  k.hideMe=!k.hideMe
 }

Upvotes: 3

Related Questions