Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 设置display=';后未显示div;块';;_Javascript_Html_Css_Angularjs_Twitter Bootstrap - Fatal编程技术网

Javascript 设置display=';后未显示div;块';;

Javascript 设置display=';后未显示div;块';;,javascript,html,css,angularjs,twitter-bootstrap,Javascript,Html,Css,Angularjs,Twitter Bootstrap,它适用于尚未隐藏的div,但我首先将display设置为none html 如果我在ng中未将display设置为none include src=“skillsTemplate”。。。它工作正常,除了第一次出现在我的评估表下面,在我单击其中一个按钮之前不会消失 如何让它第一次隐藏技能库,然后单击显示?不要硬编码ng include上的style=“display:none”,尝试使用ng show和ng hide,正如@PetrAveryanov建议的那样: HTML: 使用ng show/n

它适用于尚未隐藏的div,但我首先将display设置为none

html

如果我在ng中未将display设置为none include src=“skillsTemplate”。。。它工作正常,除了第一次出现在我的评估表下面,在我单击其中一个按钮之前不会消失


如何让它第一次隐藏技能库,然后单击显示?

不要硬编码
ng include
上的
style=“display:none”
,尝试使用
ng show
ng hide
,正如@PetrAveryanov建议的那样:

HTML:


使用ng show/ng hideI怎么样我不太喜欢JS,但我忍不住注意到你在第一个“无”上有单引号,在第二个“无”上有双引号,这会影响它吗?请继续使用工作代码
<div class="container-fluid">
    <div class="row">
        <button class ="col-md-6" ng-click="showAssessments()">Product Groups</button>
        <button class="col-md-6" ng-click="showSkills()">Skills</button>
    </div>
</div>

<ng-include src="detailsTemplate"></ng-include>
<ng-include src="skillsTemplate" style="display:none"></ng-include>
</div>
<form ng-submit="submit()" name="assessmentForm"  id="assessmentForm">
    <!-- TODO: don't use table for layout -->
    <table class="table table-striped table-bordered" assessment-input-tabber>
      //......
    </table>
</form>
<form ng-submit="submit()" id="skillsTable">
    <table class="table table-striped table-bordered" assessment-input-tabber>
       ......
    </table>
</form>
       $scope.showSkills = function(){
            document.getElementById('assessmentForm').style.display = 'none';
            document.getElementById('skillsTable').style.display = "block";
        };

        $scope.showAssessments = function(){
            document.getElementById('skillsTable').style.display = "none";
            document.getElementById('assessmentForm').style.display = "block";
        };
<ng-include src="detailsTemplate"></ng-include>
<ng-include src="skillsTemplate"></ng-include>
<form ng-submit="submit()" name="assessmentForm"  id="assessmentForm" ng-show="assessmentForm">
...
<form ng-submit="submit()" id="skillsTable" ng-show="skillsTable">
...
    $scope.assessmentForm = true;
    $scope.skillsTable = false;
    $scope.showSkills = function(){
        $scope.assessmentForm = false;
        $scope.skillsTable = true;
    };
    $scope.showAssessments = function(){
        $scope.assessmentForm = true;
        $scope.skillsTable = false;
    };