Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cescoferraro/f5d0340fcd7a3b6bda2e to your computer and use it in GitHub Desktop.
Save cescoferraro/f5d0340fcd7a3b6bda2e to your computer and use it in GitHub Desktop.
Angular ng-click with ng-show, two buttons
<div ng-app="">
<h1>Ng-show & ng-hide</h1>
<p class="description">Click on the "show"-link to see the content.</p>
<a href="" ng-click="showme=true">Show</a>
<button ng-click="showme=false">Hide</button>
<div class="wrapper">
<p ng-hide="showme">It will appear here!</p>
<h2 ng-show="showme">This is mah content, yo!</h2>
</div>
</div>
html, body {
background-color: #ecf0f1;
margin: 20px auto;
display: block;
max-width: 600px;
height: 100%;
text-align: center;
}
body {
padding: 20px;
position: relative;
}
h2, a, p, *:before,h1 {
font-family: "Helvetica Neue", sans-serif;
font-weight: 300;
}
h1 {
color: #3498db;
}
h2 {
color: #2980b9;
margin-bottom: 9px;
margin-top: 0;
font-size: 20px;
background-color: white;
/*width: 100px;*/
text-align: center;
padding: 16px;
z-index: 15;
border-radius: 4px;
transition: all 2s ease-out;
}
p {
display: block;
width: 100%;
color: #2c3e50;
clear: both;
}
.description {
margin-bottom: 70px;
}
button {
border: 0;
background-color: #3498db;
color: white;
border-radius: 4px;
padding: 5px 10px;
transition: background-color 0.2s ease-out;
cursor: pointer;
}
button:hover {
background-color: #2980b9;
}
button:active, button:hover {
outline: none;
}
a {
color: #2c3e50;
transition: color 0.2s ease-out;
/*padding: 5px 10px;*/
margin-right: 16px;
}
a:hover {
color: #2ecc71;
}
.wrapper {
border: 1px dashed #95a5a6;
height: 56px;
margin-top: 16px;
border-radius: 4px;
position: relative;
font-size: 12px;
}
.wrapper p {
line-height: 31px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment