Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 959
Tarun Avatar asked Mar 23 '15 19:03

Tarun


2 Answers

The team is working on a port of Angular Material for 2.0, and you can find the source code here.

I created a quick demo showing how to use it together with 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.

You can find additional examples in the angular2 repo.

Be aware that this is still alpha code and it is not fully functional. For example, I couldn't get MdButton to work because of this issue.

like image 170
urish Avatar answered Nov 16 '22 15:11

urish


Current version of angular-material will not work with angular 2.0, but i am sure there will be new branch(or version) which will be compatible with angualar 2.0.

like image 5
Zhorzh Alexandr Avatar answered Nov 16 '22 14:11

Zhorzh Alexandr