本文整理匯總了TypeScript中@angular/cdk/layout.MediaMatcher.matchMedia方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript MediaMatcher.matchMedia方法的具體用法?TypeScript MediaMatcher.matchMedia怎麽用?TypeScript MediaMatcher.matchMedia使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/cdk/layout.MediaMatcher
的用法示例。
在下文中一共展示了MediaMatcher.matchMedia方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
/**
* A constructor that injects many services.
*
* @param authService Authorization service.
* @param translateService Translating service.
* @param changeDetectorRef Change detector references.
* @param media A media matcher.
*/
constructor(
private authService: AuthService,
private translateService: TranslateService,
changeDetectorRef: ChangeDetectorRef,
media: MediaMatcher
) {
this.mobileQuery = media.matchMedia('(max-width: 600px)');
this._mobileQueryListener = () => changeDetectorRef.detectChanges();
this.mobileQuery.addListener(this._mobileQueryListener);
}
示例2: constructor
constructor(changeDetectorRef: ChangeDetectorRef, media: MediaMatcher, public menuItems: MenuItems) {
this.mobileQuery = media.matchMedia('(min-width: 768px)');
this._mobileQueryListener = () => changeDetectorRef.detectChanges();
this.mobileQuery.addListener(this._mobileQueryListener);
}
示例3: constructor
constructor(changeDetectorRef: ChangeDetectorRef, media: MediaMatcher) {
this.mobileQuery = media.matchMedia('(max-width: 600px)');
this._mobileQueryListener = () => changeDetectorRef.detectChanges();
this.mobileQuery.addListener(this._mobileQueryListener);
}