How to get height and width of device display in angular2 using typescript?

后端 未结 5 612
猫巷女王i
猫巷女王i 2020-12-13 01:50

I found this solution. Is it valid?

import {Component} from \'@angular/core\';
import {Platform} from \'ionic-angular\';

@Component({...})
export MyApp {
co         


        
5条回答
  •  甜味超标
    2020-12-13 02:35

    Keep in mind if you are wanting to test this component you will want to inject the window. Use the @Inject() function to inject the window object by naming it using a string token like detailed in this duplicate

提交回复
热议问题