-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(nav-schematics): Subscribe to breakpoint observable #11310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Otherwise, we are only checking if the observable is defined rather than actually checking the breakpoint.
This follow the Google guidelines for naming observables.
@@ -53,6 +53,6 @@ import { Observable } from 'rxjs'; | |||
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %> | |||
}) | |||
export class <%= classify(name) %>Component { | |||
isHandset: Observable<BreakpointState> = this.breakpointObserver.observe(Breakpoints.Handset); | |||
isHandset$: Observable<BreakpointState> = this.breakpointObserver.observe(Breakpoints.Handset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all the usages of isHandset
are checking the matches
, it would be cleaner if we added a .pipe(map(result => result.matches))
here. That way we can use isHandset$ | async
in the templates, rather than (isHandset$ | async)!.matches
.
@crisbeto Updated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -53,6 +54,12 @@ import { Observable } from 'rxjs'; | |||
changeDetection: ChangeDetectionStrategy.<%= changeDetection %><% } %> | |||
}) | |||
export class <%= classify(name) %>Component { | |||
isHandset$: Observable<BreakpointState> = this.breakpointObserver.observe(Breakpoints.Handset); | |||
|
|||
isHandset$: Observable<BreakpointState> = this.breakpointObserver.observe(Breakpoints.Handset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Observable has been changed to a boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There has already been a PR to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I updated to latest and the issue was still present. Found the PR which fixes it now. 👍
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.