I will post some code below, however, what I am trying achieve is that on a select few pages, the background of the header will become transparent unless scrolled (however, the default should be white).
app.component.html
<section>
<app-header></app-header>
<router-outlet></router-outlet>
</section>
header.component.ts
import { Component, HostListener, Input } from '@angular/core';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
})
export class HeaderComponent {
@Input() scrolled: boolean = false;
@HostListener("window:scroll", [])
onWindowScroll() {
this.scrolled = window.scrollY > 0;
}
}
This seems to work, however, on say the profile page, I want to disable this functionality, how would go about settings something on the profile.component.ts (routed) to say to the header component (in app.component.ts) 'hey, don't enable the scroll functionality'?