Creating enter animations with ngIf
AngularJS provides hooks to define a custom animation when a directive fires an enter
event. The following directives will generate enter events:
ngIf
: This fires theenter
event just after thengIf
contents change, and a new DOM element is created and injected into thengIf
containerngInclude
: This fires theenter
event when new content needs to be brought into the browserngRepeat
: This fires theenter
event when a new item is added to the list or when an item is revealed after a filterngSwitch
: This fires theenter
event after thengSwitch
contents change, and the matched child element is placed inside the containerngView
: This fires theenter
event when new content needs to be brought into the browserngMessage
: This fires theenter
event when an inner message is attached
Getting ready
Suppose that you want to attach a fade-in animation to a piece of the DOM that has a ng-if
directive attached to it. When the ng-if
expression evaluates to true
, the enter...