angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Add BrowserAnimationsModule optional support to new applications

Open dave11mj opened this issue 9 years ago • 6 comments

Bug Report or Feature Request (mark with an x)

  • [ ] bug report -> please search issues before submitting
  • [x] feature request

Versions.

@angular/cli: local (v1.1.0-beta.0, branch: master)
node: 6.9.5
os: darwin x64

Repro steps.

  1. ng new test-animation
  2. Open the app.component.ts and replace its content with the snipped below
import { Component } from '@angular/core';
import { trigger, state, style, animate, transition } from '@angular/animations';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  animations: [
    trigger('testFadeIn', [
      state('void', style({ opacity: '0' })),
      state('*',   style({ opacity: '1' })),
      transition('void <=> *', animate('100ms ease-in'))
    ])
  ]
})
export class AppComponent {
  title = 'app';
}
  1. Open app.component.html and use the @testFadeIn trigger
  2. ng serve and open the developer tools.

The log given by the failure.

image

Desired functionality.

To be able to create new applications that support animations without additional configurations. This would make it easier to use transitions and Angular Material.

An option I would propose is a --animation flag to the ng new command which would allow users to opt-in on supporting animations for their applications.

Mention any other details that might be useful.

Animations is one of the features I really like about angular, and can be sometimes tricky to set up. ^^

dave11mj avatar May 09 '17 19:05 dave11mj

@filipesilva @Brocco @dave11mj, would it be worth making this more generic? for example the cli generates a base project with only the bare minimum and then allows the user to pass in which optional modules they would like to include? something like

ng new cool-project --modules=Router,Animations,Http

deebloo avatar May 11 '17 11:05 deebloo

We generally try to avoid adding library conditionals in ng new but maybe a single flag for all Angular Modules would be a good middleground. @hansl @Brocco @sumitarora thoughts?

filipesilva avatar May 11 '17 12:05 filipesilva

I think it would make sense for all optional modules maintained in the core angular repo.

deebloo avatar May 11 '17 13:05 deebloo

@deebloo I like the idea of a more generic --modules although to me that seems a bit more disrupting since it would require to remove the well known --routing and it would need to be a bit more thought out since it would only support routing (and perhaps animations) at the moment.

@filipesilva I would not consider animations just another library / small module. It's being part of the angular core for a long time and one really appealing feature. It also has other libraries that depend on it like Angular Material.

That's why I feel could be treating like --routing providing the basic set up necessary to get new comers up and running with it. (Would be nice to add an example animation used for their reference, maybe fade in the title / new logo without generating external file this time ? lol)

Another reason I feel an --animation is necessary, is because I like the idea of the cli being animations friendly, which is why I would also be excited to see more progress on areas like animation generators seen in PR https://github.com/angular/angular-cli/pull/5381 .

dave11mj avatar May 11 '17 13:05 dave11mj

With the advent of ng add and material's usage to automatically add animations as needed, the method described herein is not something the team is looking at supporting within the CLI itself.

clydin avatar Dec 06 '18 19:12 clydin

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.