I used @angular/material:navigation <component-name> to install Schematics, for having a responsive design.
My ts looks like:
import { Component, ElementRef, ViewChild } from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Observable } from 'rxjs';
import { map, shareReplay } from 'rxjs/operators';
@Component({
selector: 'app-navbar',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.scss'],
})
export class NavbarComponent {
isSmall$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Small)
.pipe(
map(result => result.matches),
shareReplay()
);
constructor(private breakpointObserver: BreakpointObserver) {}
}
I changed isHandset to isSmall. My menu Icon disappears at 600px, but I don't want it to be disappeared. I can't change my button that it should stay between 0px and 960px. Is that possible?
Here is a table, how the breakpoints are defined.
Is it possible for me to use 2 breakpoints on one button, for example:
<button
type="button"
aria-label="Toggle sidenav"
mat-icon-button
(click)="drawer.toggle()"
*ngIf="(isSmall$ | async)">
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
</button>
That's how my button looks like, but I want it to be:
<button
type="button"
aria-label="Toggle sidenav"
mat-icon-button
(click)="drawer.toggle()"
*ngIf="(isSmall$ && isXSmall | async)">
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
</button>
I added to ngIf *ngIf="(isSmall$ && isXSmall | async)"> , I know that this isn't possible, but that is how I want it to be. Two breakpoints, that my menu icon stays active until I am at 960px, after that it should disappear.
None of the Angular breakpoint options stays between 0 and 960px.
If you guys could help me I would really appreciate it.