silvesterprabu
silvesterprabu

Reputation: 1457

How to display multiple div in one click in angular.js

I have html like this

   <div ng-controller="ClientCtrl">

        <div ng-show="shows">hello</div>

        <div ng-show="show">world</div>

        <button ng-click="show=!show">click</button>

     </div>

When I click on click button I am able to show second div (World ) . But I want to show both div when I click on click button. How to do it.?

Upvotes: 0

Views: 794

Answers (3)

tomcask
tomcask

Reputation: 181

try this:

http://plnkr.co/edit/WKvAaX its similar to @karaxuna

Upvotes: 1

karaxuna
karaxuna

Reputation: 26940

Try this:

<div ng-show="show">hello</div>

<div ng-show="show">world</div>

Upvotes: 2

Nikos Paraskevopoulos
Nikos Paraskevopoulos

Reputation: 40318

If the divs need to show on different variables, then you can try this:

<button ng-click="show=!show;shows=!shows">click</button>

Or a function in the controller. But do they really need to display on different variables?

Upvotes: 2

Related Questions