components icon indicating copy to clipboard operation
components copied to clipboard

UpgradeAdapter Support

Open amay0048 opened this issue 10 years ago • 3 comments

Feature request

I'm currently trying to incrementally upgrade an angular material1 application using the UpgradeAdapter. After 5 days of experiments and refactoring I've drawn to the conclusion that an incremental upgrade from an angular material1 to angular material2 is simply not possible.

What is the expected behavior?

I would expect the material 2 alpha components to be compatible with the upgrade adapter in some way, either an outside-in or an inside-out strategy (as described below) so that there is some to upgrade strategy for an ng-material application, even if it ends up being quite time consuming.

What is the current behavior?

I've attempted two primary strategies for upgrade, outside-in, and inside-out, without success.

For outside-in, the strategy was to move to ng2 container components, whilst ensuring that all angular material1 components remained under control of ng1 by using the upgradeNg1Component method of the adapter as a bridge for any immediate children of ng2 components. To implement, I upgraded my container components first, some of which had direct descendent's that were angular material elements. The result was that the current angular material1 components could not be easily upgraded (either via simple drop-in or via config decorators) to work with the upgrade adapter, as they do not conform to the angular1.5 component specification, and cannot be easily monkey-patched to confirm to this spec. This left me no choice but to abandon this strategy.

For inside-out, I split out angular material1 dependency into it's separate imports, to ensure that I was only including what was necessary for the project. The strategy was to incrementally replace the angular material1 component implementations with the angular material2 component implementations, by switching out the components one by one using the downgradeNg2Component method of the adapter as a bridge. This failed almost immediately, with the error message: Uncaught Error: Only selectors matching element names are supported, got: button[md-button], button[md-raised-button], button[md-icon-button], button[md-fab], button[md-mini-fab]. From reading the documentation, my understanding is that this due to the angular material2 selector for the md-button component (e.g button[md-button]) clashing with the angular material1 namespace, therefore neither framework being able to determine who owns the target component.

What are the steps to reproduce?

TODO: I will provide plunker templates to demonstrate the issues with both aforementioned upgrade strategies shortly.

What is the use-case or motivation for changing an existing behavior?

With the recent release of angular2 I understand the motivation to create the angular material2 component library as quickly as possible, however it appears that an incremental upgrade strategy has been ignored in favour of an all or nothing approach to the angular2 framework. Part of my job is to make a business case for upgrading currently angular1 applications to angular2, and for larger codebases, the upgrade adapter and an incremental approach significantly decreases the risk, and increases the likely-hood that approval will be given to make this transition.

I've typically been a supporter of angular, due to the informed and opinionated nature of the framework, it's wholistic approach to web app development, the lack of decision fatigue related to upgrades, and ease of augmenting the team with contact developers due to the consistent application design patterns that the angular framework provides.

With the lack of a clear upgrade strategy, and the apparent all or nothing approach of the angular material 2 project, most of of the business benefits outlined in the previous paragraph are negated. I am therefore in a position where our team is currently re-evaluating our front-end build pipeline, and our development stack, and Angular Material2 is presenting a significant amount of friction, especially when contrasted with similar alternatives.

Which versions of Angular, Material, OS, browsers are affected? Angular Material 1, and Angular Material 2

Is there anything else we should know?

From a business and upgrade perspective, it would be good to clarify your strategy with respect to the UpgradeAdapter, to identify further incremental upgrade paths, and how they might be supported.

If the UpgradeAdapter in not treated as a first class citizen with respect to the angular material project, that would be very disappointing, and in my opinion, trigger an industry movement away from angular towards other frameworks.

I will provide plunker examples for the two strategies I have tried, and look forward to seeing how the project evolves.

Regards, AM

amay0048 avatar Sep 20 '16 16:09 amay0048

See here to replicate this issue: https://github.com/angular/angular/issues/11280

amay0048 avatar Sep 23 '16 02:09 amay0048

Should be resolved by changes in ngUpdgrade

jelbourn avatar Nov 04 '16 01:11 jelbourn

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.