【发布时间】:2017-05-15 11:45:07
【问题描述】:
我扼杀了能够捕捉到这个错误。
在桌面上,此代码引发此NotSupportedError:
我通常在 chrome 上调试。
代码如下:
import {Component} from "@angular/core";
import {ScreenOrientation} from "@ionic-native/screen-orientation";
@IonicPage()
@Component({
selector: 'page-loading',
templateUrl: 'page-loading.html',
})
export class PageLoading {
constructor(private screenOrientation:ScreenOrientation) {}
ionViewDidLoad() {
console.log('ionViewDidLoad PageLoading');
try{
this.screenOrientation.lock(this.screenOrientation.ORIENTATIONS.PORTRAIT).then(()=>{
console.log('lock');
});
}catch(e){
console.warn('No cordova.js')
}
}
}
【问题讨论】:
-
离子原生或者cordova不适用于离子服务..你只需要在设备或模拟器中运行
-
是的,我知道,但是对于其他没有问题的插件,他们抱怨沉默。我只是想在我的桌面上消除这个错误,但是 try catch 没有帮助
-
哦,你的意思是在离子视图屏幕中?
-
不,我像你说的那样使用离子服务,我只是不知道为什么我能捕捉到这些错误