Skip to content

Instantly share code, notes, and snippets.

@mqtik
Created October 6, 2018 03:50
Show Gist options
  • Save mqtik/86c2ec6537025b2cf1eca0f8ffb5982d to your computer and use it in GitHub Desktop.
Save mqtik/86c2ec6537025b2cf1eca0f8ffb5982d to your computer and use it in GitHub Desktop.
Animations faded on NG-IF
<style>
.animate-if {
background:white;
border:1px solid black;
padding:10px;
}
.animate-if.ng-enter, .animate-if.ng-leave {
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
}
.animate-if.ng-enter,
.animate-if.ng-leave.ng-leave-active {
opacity:0;
}
.animate-if.ng-leave,
.animate-if.ng-enter.ng-enter-active {
opacity:1;
}
</style>
<label>Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /></label><br/>
Show when checked:
<span ng-if="checked" class="animate-if">
This is removed when the checkbox is unchecked.
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment