[英]Hide parent div and show ui-view in Angular Js
How to hide the div "whole" when click on #clickit so that my setting page content won't show and .user page will show in ui-view 如何在单击#clickit时隐藏“整个” div,以使我的设置页面内容不显示并且.user页面将在ui-view中显示
setting html page 设置HTML页面
<!-- page content -->
<div class="whole">
<div class="page-title">
<div class="title_left">
<h3>Settings</h3>
</div>
<div class="clearfix"></div>
<div class="row" id="clickit"> // <-- Click to hide "whole" class
<div class="col-md-12 col-sm-12 col-xs-12">
<a ui-sref=".user">Users & practitioners</a>
</div>
</div>
</div>
</div>
<div ui-view> // I HAVE TO SHOW THIS DIV AND HIDE SETTING DIV
</div>
<!-- /page content -->
I don't want a jquery solution.. all i need a angular of pure javascript solution 我不想要一个jQuery解决方案..我只需要一个纯JavaScript解决方案
<div class="whole" ng-hide="hideWhole> // <-- assign a scope var dependency
<div class="page-title">
<div class="title_left">
<h3>Settings</h3>
</div>
<div class="clearfix"></div>
<div class="row" id="clickit" ng-click="hideWhole=1"> // <-- update scope var
Ideally you'll use a controller variable ( ctrl.hideWhole
in controllerAs syntax) so you can update the display of the element from elsewhere in the app. 理想情况下,您将使用控制器变量(controllerAs语法中为
ctrl.hideWhole
),以便可以从应用程序中的其他位置更新元素的显示。
Here is a JavaScript solution to your problem, attaching a function to the onclick event of your element which sets the css display attribute to none. 这是解决您问题的JavaScript解决方案,将一个函数附加到元素的onclick事件上,该事件将css display属性设置为none。
<div class="row" id="clickit" onclick="hideWhole()">
function hideWhole() {
var wholeDiv = document.getElementsByClassName(".whole");
wholeDiv.style.display = 'none';
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.