Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can I import animation components from both @angular/animations and @angular/core?

I recently updated to angular 4 and checking the animations docs I see I should import trigger, animate and transition from @angular/animations.

import {
  Component,
  Input
} from '@angular/core';
import {
  trigger,
  state,
  style,
  animate,
  transition
} from '@angular/animations';

In my project however I have been importing from @angular/core so far and everything works fine, even after animations were separated from core.

import { ... trigger, state, style, animate, transition } from '@angular/core';

Why does angular core still hold these animation components ? Backwards compatability maybe ? Why not just remove it completely from core?

like image 218
Lucas Avatar asked Dec 08 '25 10:12

Lucas


2 Answers

Imports from @angular/core were deprecated.

https://angular.io/api/core/animate

This symbol has moved. Please Import from @angular/animations instead!

I think they will remove them from core one day.

like image 189
augustine Avatar answered Dec 11 '25 14:12

augustine


Taken from the changelog. It is deprecated but you can still use it in your app. Not all programmers have the luxury to update their apps on every new release. It is just a warning that you should update your code, so that when the major release happens, your migration will be smooth. Hope this helps.

like image 23
brijmcq Avatar answered Dec 11 '25 13:12

brijmcq



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!