Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.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 Angularjs隐藏显示干净编码_Javascript_Angularjs_Html - Fatal编程技术网

Javascript Angularjs隐藏显示干净编码

Javascript Angularjs隐藏显示干净编码,javascript,angularjs,html,Javascript,Angularjs,Html,嘿,伙计们,我想知道是否有办法解决我通常在角度项目中造成的混乱: app.controller('indexController', function ($scope) { scope.hideWinkelContainer = true; scope.hideWinkelPaneel = true; scope.headerCart = false; scope.showCart = function () { scope.hideWinkelC

嘿,伙计们,我想知道是否有办法解决我通常在角度项目中造成的混乱:

app.controller('indexController', function ($scope) {
    scope.hideWinkelContainer = true;
    scope.hideWinkelPaneel = true;
    scope.headerCart = false;
    scope.showCart = function () {
        scope.hideWinkelContainer = false;
        scope.hideWinkelPaneel = false;
    };
    scope.hideCart = function () {
        scope.hideWinkelContainer = true;
        scope.hideWinkelPaneel = true;
    };
});
html:



欢迎提供最佳实践、提示和示例

您只需使用
切换
功能,如下所示:

app.controller('indexController', function ($scope) {
    $scope.hideWinkelContainer = true;
    $scope.hideWinkelPaneel = true;
    $scope.headerCart = false;

    $scope.toggleCart = function () {
        $scope.hideWinkelContainer = !$scope.hideWinkelContainer;
        $scope.hideWinkelPaneel    = !$scope.hideWinkelPaneel;
    };
});
在HTML中:

<div class="containerWinkelwagen" ng-hide="hideWinkelContainer">
    <div class="winkelWagenPaneel" ng-hide="hideWinkelPaneel">
        <div class="winkelWagenTerug" ng-click="toggleCart()"></div>
        <div class="winkelWagenTerug" ng-click="toggleCart()"></div>
    </div> 
</div>

您只需使用
切换功能,如下所示:

app.controller('indexController', function ($scope) {
    $scope.hideWinkelContainer = true;
    $scope.hideWinkelPaneel = true;
    $scope.headerCart = false;

    $scope.toggleCart = function () {
        $scope.hideWinkelContainer = !$scope.hideWinkelContainer;
        $scope.hideWinkelPaneel    = !$scope.hideWinkelPaneel;
    };
});
在HTML中:

<div class="containerWinkelwagen" ng-hide="hideWinkelContainer">
    <div class="winkelWagenPaneel" ng-hide="hideWinkelPaneel">
        <div class="winkelWagenTerug" ng-click="toggleCart()"></div>
        <div class="winkelWagenTerug" ng-click="toggleCart()"></div>
    </div> 
</div>

您只需使用
切换功能,如下所示:

app.controller('indexController', function ($scope) {
    $scope.hideWinkelContainer = true;
    $scope.hideWinkelPaneel = true;
    $scope.headerCart = false;

    $scope.toggleCart = function () {
        $scope.hideWinkelContainer = !$scope.hideWinkelContainer;
        $scope.hideWinkelPaneel    = !$scope.hideWinkelPaneel;
    };
});
在HTML中:

<div class="containerWinkelwagen" ng-hide="hideWinkelContainer">
    <div class="winkelWagenPaneel" ng-hide="hideWinkelPaneel">
        <div class="winkelWagenTerug" ng-click="toggleCart()"></div>
        <div class="winkelWagenTerug" ng-click="toggleCart()"></div>
    </div> 
</div>

您只需使用
切换功能,如下所示:

app.controller('indexController', function ($scope) {
    $scope.hideWinkelContainer = true;
    $scope.hideWinkelPaneel = true;
    $scope.headerCart = false;

    $scope.toggleCart = function () {
        $scope.hideWinkelContainer = !$scope.hideWinkelContainer;
        $scope.hideWinkelPaneel    = !$scope.hideWinkelPaneel;
    };
});
在HTML中:

<div class="containerWinkelwagen" ng-hide="hideWinkelContainer">
    <div class="winkelWagenPaneel" ng-hide="hideWinkelPaneel">
        <div class="winkelWagenTerug" ng-click="toggleCart()"></div>
        <div class="winkelWagenTerug" ng-click="toggleCart()"></div>
    </div> 
</div>


您可以在工厂实现一次显示/隐藏功能,然后将其注入需要的控制器中。保存了大量样板文件。

您可以在工厂实现一次显示/隐藏功能,然后将其注入需要的控制器中。保存了大量样板文件。

您可以在工厂实现一次显示/隐藏功能,然后将其注入需要的控制器中。保存了大量样板文件。

您可以在工厂实现一次显示/隐藏功能,然后将其注入需要的控制器中。节省了大量的样板文件。

你写的东西有什么问题?你在寻找一些优化吗?不要忘记保持它的可维护性(lel角度可维护性)简单!你写的东西有什么问题?你在寻找一些优化吗?不要忘记保持它的可维护性(lel角度可维护性)简单!你写的东西有什么问题?你在寻找一些优化吗?不要忘记保持它的可维护性(lel角度可维护性)简单!你写的东西有什么问题?你在寻找一些优化吗?不要忘记保持它的可维护性(lel角度可维护性)简单!