【发布时间】:2017-01-25 07:26:09
【问题描述】:
我将在我的项目中使用 nativescript-orientation 插件。 https://github.com/NathanaelA/nativescript-orientation#argslandscape--true--false
我想在方向自动更改时更改所有布局。 所以我要使用这个功能。
exports.orientation(args)
args.landscape = true | false
args.page (depreciated) or args.object = the current page
但我不知道如何将它插入到我的 typescript & angluar 2 项目中。
import { Component, OnInit } from "@angular/core";
var Orientation = require( "nativescript-orientation" );
@Component({
selector: "my-app",
templateUrl: "app.component.html",
})
export class AppComponent implements OnInit {
public counter: number = 16;
public get message(): string {
if (this.counter > 0) {
return this.counter + " taps left";
} else {
return "Hoorraaay! \nYou are ready to start building!";
}
}
ngOnInit(){
console.log(Orientation.getOrientation()+"--phone");
}
public onTap() {
this.counter--;
}
}
export function orientation(args){
}
【问题讨论】:
标签: javascript typescript nativescript angular2-nativescript