How to use angular material (https://material.angularjs.org) in Angular 2 Apps?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 03:37:08

问题


I remember having seen angular-material.css being used in one of the Angular 2 Demos at ng-conf. Can someone confirm if this works...

Also, is it possible to use the following in Angular 2 Apps:

  • angular-material.js
  • angular-animate.js
  • angular-aria.js

I know that above js have a dependency on Angular 1.3+, but what if I add that dependency over and above my Angular 2 dependency. Will these work then?


回答1:


So currently you cannot use the current angular material with angular2.

According to Marcy Sutton, they will be addressing incorporation of Angular Material once the team has realeased 1.x.

https://github.com/angular/material2 is the new repo that will be compatible with ng2. There are some forks of Material that may work with ng2 already such as ng2-material.




回答2:


No, Angular Material 1.x does not support Angular 2+. You can see some of the issues and discussion around this in issue #6336. Basically, many of the existing, tested components would need to be re-written (many months of work).

material2 only recently (Dec 2016) entered beta and may not be ready for all production applications. If you need Material Design for your Angular 2 app ASAP, then contributing to material2 is your best option.

As far as I know, there is no Material Design library that is production ready (out of beta) for Angular 2+.

I was using Angular2-Polymer with Polymer paper elements to get Material Design in my Angular 2+ applications, but breaking changes in Angular 2.2 have broken that integration and may require a significant re-write of the lib.

Material Components for the Web may someday be another option, but they are in alpha atm.



来源:https://stackoverflow.com/questions/30611457/how-to-use-angular-material-https-material-angularjs-org-in-angular-2-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!