question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Dark Theme background not taking effect when Router-Outlet is used.

See original GitHub issue

Bug

When a router-outlet is included in the root component, the mat-app-background doesn’t seem to take effect.

What is the expected behavior?

When I toggle to a dark theme, I expect the background color to go dark.

What is the current behavior?

The background color remains white irrespective of whether mat-app-background is included.

What are the steps to reproduce?

The plunker doesn’t let me repro the issue with SCSS, so have created a simple repo here that you can activate using yarn followed by ng serve. The screenshot below should also help.

Below is the dark theme activated, you can see the background remains white even though we added the mat-app-background to body.

image

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

I think the experience of adding mat-app-background should work irrespective of whether router-outlets are involved.

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

OS: Mac OSX Dependencies including Angular, Angular-CLI below:

"dependencies": {
    "@angular/animations": "^4.1.0",
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/material": "^2.0.0-beta.3",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.0.1",
    "@angular/compiler-cli": "^4.0.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0"
  }

Is there anything else we should know?

Have tried various hacks such as applying min-width:100vh to various root tags to see if this had any bearing, to no effect.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewseguincommented, Nov 21, 2017

Looks like #3298 will be helpful here. If there is further issue here can you please re-open?

0reactions
angular-automatic-lock-bot[bot]commented, Sep 10, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Angular Theme through RouterOutlet
Show activity on this post. Hello I got the problem that I have a separate setting component which should be able to change...
Read more >
Common Routing Tasks - Angular
To use the Angular router, an application needs to have at least two components so that it can navigate from one to the...
Read more >
Navigation - NativeScript Docs
Learn about the basic application structure of NativeScript apps, and how to navigate between pages with the help of the router links and...
Read more >
Angular Navigation: How Routing & Redirects Work in Angular ...
We recommend only using non-linear routing if your application meets the tabs or nested router outlet use cases. For more on tabs, please...
Read more >
How to style React Router links with styled-components
You may have noticed we used NavbarLink instead of the link component in react-router-dom . NavbarLink is the same link, but with styling ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found