0

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();
 }
2

2 Answers 2

3

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
 }
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.