Disabling Angular animations conditionally
In this recipe, you’ll learn how to disable animations in Angular conditionally. This is useful for a variety of cases, including disabling animations on a particular device, for example.
Pro tip: Use ngx-device-detector
to identify if your Angular app is running on a mobile, tablet, etc. (A little secret that is not so-secret anymore…I built it!)
Shameless plug aside, in this recipe, we’ll disable animations for employees in the application, considering we’re rolling out animations only for admins at the moment.
Getting ready
The app that we are going to work with resides in start/apps/chapter04/ng-disable-animations
inside the cloned repository:
- Open the code repository in your code editor.
- Open the terminal, navigate to the code repository directory, and run the following command to serve the project:
npm run serve ng-disable-animations
This should...