简体   繁体   中英

Display a table when click on a button using angularJS

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

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 

    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM