monty_lennie
monty_lennie

Reputation: 3331

How can I use angular material with angular 2?

I've tried npm install angular-material --save and followed the instructions here.

Then I added the script and link to index.html

<script src="node_modules/angular-material/index.js"></script>
<link ref="stylesheet" href="node_modules/angular-material/modules/angular-material.css">

Then I tried adding a simple <md-button> but am having no luck.

Upvotes: 5

Views: 4884

Answers (2)

Charleston
Charleston

Reputation: 1569

An alternative is use materialize from https://materializecss.com You just import this files into your index.html that is in src folder

<!-- Compiled and minified CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css">

    <!-- Compiled and minified JavaScript -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/js/materialize.min.js"></script>

thus you can use material design ex:

 <label>
    <input type="checkbox" />
    <span>Red</span>
  </label>

Upvotes: 0

Mark Rajcok
Mark Rajcok

Reputation: 364677

Since this question was written, the Angular team has created the "Material Design for Angular 2" github project: https://github.com/angular/material2

See the Getting Started guide for installation instructions.

They want you to (install and) use the Angular CLI.

Since both projects are currently in alpha, the instructions below may change over time:

# install the CLI globally
npm install -g angular-cli

# create a new project
ng new my-project

# install Angular Material 2 components
npm install --save @angular2-material/{core,button,card}

Upvotes: 3

Related Questions