You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of the core concepts in bootstrap are the media queries (sm, md, lg, xl) where you can conditionally show/hide elements based upon the browser size.
Proposal
Expose a service where users can get the media query as an observable
// media query typesexportenumMediaQueryOption{xs,sm,md,lg}// service to provide accessexportclassMediaQueryService{getMediaQuery(): Observable<MediaQueryOption>{ ... }}// sample usage
@Component({ ... })exportclassSampleComponentimplementsOnInit{isXs: Observable<boolean>constructor(privatemedia: MediaQueryService){}ngOnInit(){this.isXs=this.media.getMediaQuery().map(m=>m===MediaQueryOption.xs);}}
Future Considerations
Create corresponding directives that could internally use this above service for example... IfXs - to only show in xs view IfHideXs - to hide only in xs view
Allow configuration values to override the default media query breakpoints
The text was updated successfully, but these errors were encountered:
Background
One of the core concepts in bootstrap are the media queries (
sm
,md
,lg
,xl
) where you can conditionally show/hide elements based upon the browser size.Proposal
Expose a service where users can get the media query as an observable
Future Considerations
Create corresponding directives that could internally use this above service for example...
IfXs
- to only show in xs viewIfHideXs
- to hide only in xs viewAllow configuration values to override the default media query breakpoints
The text was updated successfully, but these errors were encountered: