1

Hi i am working on a django powered project. I have a button in my html as follows:

<tr align="left"><b><span style="background-color:white;"><button>{{ k }}</button></span></b></tr>

Am planning to use angularJS to display a table below once the user click the button above. I have the cotrolller below as follows:

% block extrascript %}


    {{ngapp}}.controller("MyCtrl", function($scope, $resource) {

    });
{% endblock %}

Sorry for the less amount of angularjs. Am very much new to angularJS. Can I have some suggestions guys? Thanks in advance

1
  • How to use ng-click, ng-show in this scenario? Commented Feb 24, 2016 at 3:03

1 Answer 1

3

Try something this:

<table ng-show="show">

 </table>
 <button ng-click="show=!show">{{ k }}</button>


 app.controller('MainCtrl', function($scope) {
      $scope.show = false; // Hide it initially 

    });
Sign up to request clarification or add additional context in comments.

3 Comments

Yes Praveen. But how can I do ng-show or ng-hide inside that function?
Thats exactly what I want Praveen. Actually my tables are under a for loop. So there will be multiple tables. As per your answer when I click the button all my tables are getting displayed once i click the button. I just want the specific table to be displayed. How do I prevent that?
Then you must be having many buttons also right? So, You can bind different variables to each table and its corresponding button. like show1, show2, etc.

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.