In app.component (the main one of the application) I have:

```
<div id="wrapper">
<!-- Header
================================================== -->
    <header  class="transparent sticky-header full-width">
.
.
.
    <div class='container-fluid'>
        <div class='row'>
            <div class='col-sm-3'>
                <nav-menu></nav-menu>
            </div>
            <div class='col-sm-9 body-content'>
                <flash-messages></flash-messages>
                <ng2-toasty></ng2-toasty>
                <router-outlet></router-outlet>
            </div>
        </div>
    </div>
.
.
.

```

I want the header to keep "transparent" class only on home.component. On all the other components I want to keep the other two classes, without "transparent".

A hierarchy that should explain better how the components are structured can be seen in the below picture:

[![enter image description here](https://i.stack.imgur.com/LYBSY.png)](https://i.stack.imgur.com/LYBSY.png)

So, the home component is not the parent, but app.component is the parent. home.component is a child as are the others.

app.component.ts

```
import { Component, ErrorHandler } from '@angular/core';
import { ToastyService } from "ng2-toasty";
import { AppErrorHandler } from "../../app.error-handler";
import { HomeComponent } from "../home/home.component";
import { ActivatedRoute, Router } from "@angular/router";

@Component({
    selector: 'app',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css'],
    providers: [
        HomeComponent,
        ToastyService,
        { provide: ErrorHandler, useClass: AppErrorHandler }
    ]
})
export class AppComponent {
    classes: string;
    constructor(private home: HomeComponent, private route: ActivatedRoute,
        private router: Router) {
        //this.classes = false;
        //if (this.router.url ==='/home')
        //{
        //    this.classes = true;
        //}
        this.classes = "transparent sticky- header full- width";
    }
}

```

I have tried to make a variable classes and pass it with ngClass, but it does not work.

I have searched for solutions and all I've found were based on events.