[英]Display a table when click on a button using angularJS
Hi i am working on a django powered project. 嗨,我正在研究一个django动力项目。 I have a button in my html as follows:
我的html中有一个按钮如下:
<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. 一旦用户点击上面的按钮,我打算使用angularJS来显示下面的表格。 I have the cotrolller below as follows:
我有下面的cotrolller如下:
% block extrascript %}
{{ngapp}}.controller("MyCtrl", function($scope, $resource) {
});
{% endblock %}
Sorry for the less amount of angularjs. 抱歉,少量的angularjs。 Am very much new to angularJS.
对于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
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.