Skip to content

ng add @angular/material does not add styles to the app #11169

Closed
@beeman

Description

@beeman

Bug, feature request, or proposal:

When running ng add @angular/material on a new Angular app generated with Angular CLI v6 the styles are not applied.

What is the expected behavior?

The Angular Material stylesheet 'indigo-pink' gets applied.

What is the current behavior?

The stylesheet does not get applied.

Also, the schematic seems to update node_modules/@angular/material/prebuilt-themes/indigo-pink.css instead of src/styles.{ext} by adding body { margin: 0; }.

 ng add @angular/material
Installing packages for tooling via npm.
npm WARN @angular/material@6.0.0 requires a peer of @angular/cdk@6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ @angular/material@6.0.0
added 1 package in 16.059s
Installed packages for tooling via npm.
UPDATE package.json (1390 bytes)
UPDATE angular.json (3766 bytes)
UPDATE src/app/app.module.ts (423 bytes)
UPDATE src/index.html (483 bytes)
UPDATE node_modules/@angular/material/prebuilt-themes/indigo-pink.css (56678 bytes)

What are the steps to reproduce?

Providing a StackBlitz reproduction is the best way to share your issue.

StackBlitz starter: https://goo.gl/wwnhMV

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.0
Node: 10.0.0
OS: linux x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0
@angular/cdk                      <error>
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0
 npm show @angular/material

{ name: '@angular/material',
  description: 'Angular Material',
  'dist-tags': { latest: '6.0.0', next: '6.0.0' },

Is there anything else we should know?

Metadata

Metadata

Assignees

Labels

cannot reproduceThe team is unable to reproduce this issue with the information provided

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions