Answer the question
In order to leave comments, you need to log in
How to connect Material Design + Angular 2 + Webpack?
Who has experienced this?
I'm just getting started with Angular 2 and I'm a bit confused about the versions.
Since I used to work with Webpack, I use it out of habit.
This results in:
//////////////////
// WEBPACK
///////////
new DllBundlesPlugin({
bundles: {
'@angular/material',
}
})
// APP MODULE
import { MaterialModule } from '@angular/material';
// Какую версию нужно устанавливать @angular/material or @angular2-material ?
import { MaterialModule } from '@angular2-material';
import 'hammerjs';
@NgModule({
imports: [MetarialModule.forRoot()]
})
// COMPONENT
// import { MdButton } from '@angular/material';
import { MdButton } from '@angular2-material/button';
@Component({
selector: 'test',
templateUrl: './test.html',
directive: [MdButton] // Выдаёт такую ошибку
//Generic type 'Type<T>' requires 1 type argument(s)
// Argument of type '{ selector: string; template: any; directives: typeof MdButton[]; }' is not assignable to parameter of type 'Component'.
//Object literal may only specify known properties, and 'directives' does not exist in type 'Component'.
})
Answer the question
In order to leave comments, you need to log in
I advise you to use the Angular CLI
directive: [MdButton] // Not relevant
https://material.angular.io/components/component/button
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question