网络材料组成与角度材料2

最近,MDL (材料设计精简版)项目的继承者作为 网络材料组件启动。其目标之一是“与其他 JS 框架和库的无缝集成”。

还有另一个项目 角质材料2,它提供材料设计组件专门为角(v2 +)。

这两个项目都是创建基于 UI 组件的材料设计。此外,他们有类似的一套组件 准备好了/正在进行中的发展,和相同的一套组件即将(列出的 给你给你)。

有人可以帮助我了解2个项目之间的重叠,我应该为新的项目选择哪一个?

在基本层面上,我确实明白,Angular Materials 2将更加无缝和紧密地与 Angular 项目集成,而 Web 材料组件将为多个 JS 框架提供可使用的钩子。但我看不出重叠的原因,以及哪一个将有更多的动力(阅读更多的组件)。

20794 次浏览

Full disclosure: I work on Material Components for the web, so my opinion may be a bit biased :)

TL;DR use whichever library helps you build your UI in the most efficient way possible, or use them side-by-side. Check out our angular2 integration example angular-mdc-web to see how to wrap a MDC-Web component using ng2.

The goal of Material Components for the web (abbrev. MDC-Web), as has been alluded to, is to create a canonical implementation of Material Design components for the entire web platform. Angular/material2 is an excellent library - many of us on the Material Design team, myself included, have contributed to it - but it is exclusionary to non-angular2 applications. Additionally, non-google libraries and frameworks such as React, Aurelia, Vue, and others have no official solution to suit their needs.

That being said, Angular2 falls under our scope of the "entire web platform", and we definitely want to support it because of that. At this stage in both projects, we may have some components you need that angular/material2 does not, or vice versa. I'd encourage you to use whichever library helps you accomplish your goals in the best way possible. That could be angular/material2, it could be MDC-Web, or quite honestly it could be both. For example, you could use our select component along side material2's components, and things should work just fine. As mentioned in the TL;DR,angular-mdc-web is a fully-featured library that wraps MDC-Web in an idiomatic angular2+ API.

On a final note, MDC-Web is the only library that is developed by the Material Design team itself. Because of this, we are able collaborate on and iterate with the same people who author the Material Design spec.

Update( 16 March 2018 ):

From the comments provided by @elDuderino Material2 seems to have a way to customize . The answer provided was before Material had cdk ..

https://material.angular.io/guide/customizing-component-styles

Both frameworks are very matured now. I use both of them in different projects. It took me only a week to migrate a project from one framework to other. So I would suggest try both and see which you find comfortable.


I will share my experience. Its opinionated and biased. Love to be corrected.

We are starting from scratch and using Angular. We decided to go with Material. I started my hunt for a better framework and tried all of them: Materialize, MDL, Angular Material 2 and finally MDC for web.

Here are my observations, especially for Material2 vs MDC for Web.

Material2

  • Pros
    • Readymade. Everything is available and ready to start working on
    • Architecture close to Angular
  • Cons

    • Components list is not complete yet ( they will get over the time, so its ok )
    • Customizing is impossible

    I know we can add themes, that's all. All the HTML and CSS for the components is added in Angular Components. So it's compiled as JavaScript and applies at runtime. So, there is no way to override the behavior. I tried for a week and could not do it.

    Here are questions I asked ( one of them marked to close as it appeared to be asking for opinions -.- )

    How to customize Angular Material 2

    How to Extend Angular Component style

    Of course they did not get any answers and I could not customize them. If I am wrong, please direct me.

Check update provided above

MDC for Web

  • Cons

    • Not readily available for Angular

    We can't start using it straight away if you want to do it Angular way. Need to write a wrapper for Angular for each component. Might take some effort. But every team can afford some time to customize and there are third party efforts to make it easier. If it's ok not to do it in angular way, I believe we can start off without the wrappers.

    • Components list is not complete yet ( they will get over the time, so it's ok )
  • Pros

    • Generic, not tied to framework. Always safe to invest in.
    • More contribution, since other frameworks developers also use it. Over the time it gets more contributions and future proof (almost )
    • Totally customizable.
    • Appears like only framework Material design team is directly involved with
    • Can use the knowledge/styles for mobile devices too.
    • Documentation is awesome. Looks like a lot of effort and time is put in.

It seems like the Angular Material team plans to collaborate with the MDC team:

High level stuff planned for Q4 2018 (October - Dec):

  • Improve our own build and automation tooling
  • Fix bugs and reduce some technical debt inside Google
  • Working on long-term plans on how to collaborate with the MDC Web team
  • Designs for advanced table improvements (column resize, selection directives, inline-edit)

(README)

This has been added to the readme about 20 days ago (Oct 10, 2018).
So chances are, that in future Angular Material is just some kind of Angular wrapper or Angular implementation of the MDC for Web.

For folks considering Angular Material 2, the Sketch Material Plugin/Theme Editor and the Gallery tool is only available for MDC. I am on the same path, and I started with Angular Material 2, and with the recent introduction on Angular Ivy, I am not sure how much effort the team is going to put in the Angular Material 2. I am moving to MDC, which is a safe bet.

From the recent Readme :

High level stuff planned for Q1 → Q2 2019 (January - June):

  • Most of the Angular Material team is on loan to the framework team helping with Ivy. We've been using the Angular CDK and Angular Material tests to validate code paths as well as helping debug issues in switching Google applications to the new rendering pipeline.
  • We're also working with the Material Design team on a strategy to collaborate more deeply. We'll have more to share on this once our plans are further along.
  • Assorted bugfixes and minor feature improvements.
  • Design for API enhancements to the tree component to improve ergonomics.

Angular Material 2 is still out of date and does not implement the material spec correctly. Don't use it.