0

Onclick 角度の概念を使用して、あるセクションを表示し、別のセクションを非表示にする必要があります。

私はこれらを試しました

<div data-ng-click="showDetails = ! showDetails">Apps</div>
<div data-ng-click="showDetails1 = ! showDetails1">Favorites</div>
<div data-ng-click="showDetails2 = ! showDetails2">Search</div>


<section id="workbench-search" data-ng-class="{ 'hidden': ! showDetails }">search</section>

    <section id="workbench-favorites" data-ng-class="{ 'hidden': ! showDetails1 }">fav</section>

    <section id="workbench-apps" data-ng-class="{ 'hidden': ! showDetails2 }">apps</section>

しかし、onclickは他のものを隠していません。

角度のある方法で提案できますか。角度の概念が新しい

4

2 に答える 2

2

試す

<div ng-click="showDetails = !showDetails; showDetails1 = false; showDetails2 = false;">Apps {{showDetails}}</div>
<div ng-click="showDetails1 = !showDetails1; showDetails = false; showDetails2 = false;">Favorites {{showDetails1}}</div>
<div ng-click="showDetails2 = !showDetails2; showDetails = false; showDetails1 = false;">Search {{showDetails2}}</div>


<section id="workbench-search" ng-class="{ 'hidden': !showDetails }">search</section>

<section id="workbench-favorites" ng-class="{ 'hidden': !showDetails1 }">fav</section>

<section id="workbench-apps" ng-class="{ 'hidden': !showDetails2 }">apps</section>

デモ:プランカー

于 2013-08-20T10:35:18.670 に答える