简体   繁体   English

棱角2.0 alpha是否适用于角度/材料项目中的组件?

[英]Does angular 2.0 alpha work with the components in angular/material Project?

I've been trying to get this to work, but haven't been able to. 我一直试图让这个工作,但一直没能。 If it's possible, please point to a sample. 如果可能的话,请指向一个样本。

The team is working on a port of Angular Material for 2.0, and you can find the source code here . 该团队正在开发Angular Material for 2.0的端口,您可以在此处找到源代码。

I created a quick demo showing how to use it together with Angular 2: 我创建了一个快速演示,展示了如何与Angular 2一起使用它:

import {Component, View, bootstrap} from 'angular2/angular2';
import {MdInput, MdInputContainer} from 'angular2_material/material';

// Defines a new HTML tag <hello-ngconf>
@Component({
    selector: 'material-demo'
})
@View({
    template: `
    <md-input-container>
      <label>Your name</label>
      <input #newname />
    </md-input-container>
    <p>
      Hello, {{newname.value}}
    </p>
    `,
    directives: [MdInputContainer, MdInput]
})
class MaterialDemoComponent {
}

bootstrap(MaterialDemoComponent);

See in action in this plunker . 看看这个plunker的行动。

You can find additional examples in the angular2 repo . 您可以在angular2 repo中找到其他示例。

Be aware that this is still alpha code and it is not fully functional. 请注意,这仍然是alpha代码,并且功能不完全。 For example, I couldn't get MdButton to work because of this issue . 例如,由于这个问题 ,我无法让MdButton工作。

当前版本的角度材料不适用于角度2.0,但我相信会有新的分支(或版本)与angualar 2.0兼容。

I know this question is old, but I did discover today they have a link in the angular/material README that points to a repository they created specifically for the angular2 target of angular/material: https://github.com/angular/material2 我知道这个问题很老,但我今天发现它们在角度/材料自述文件中有一个链接指向他们专门为角度/材料的angular2目标创建的存储库: https//github.com/angular/material2

It's still in alpha0. 它仍然在alpha0。

As a suggestion, perhaps it might help to use something like http://www.getmdl.io/ until material2 gets off the ground. 作为一个建议,也许它可能有助于使用像http://www.getmdl.io/这样的东西,直到material2开始。 It might allow you to prototype sooner. 它可能允许您更快地进行原型设计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM