按照教程,我正在开发我的第一个应用程序。在这个应用程序中,我想实现滑动导航。但我面临一个问题:我无法访问我的组件对象。
我正在使用 NativeScript + Angular。
constructor(
private _router: Router
, private _routeParams: RouteParams
, private _signalListService: SignalListService
, private _page : Page
) {
console.log('ViewPageConstructor : ' + this);
this.itemId = this._routeParams.get("id");
this._page.on("swipe", function(args: gestures.SwipeGestureEventData) {
console.log("Swipe Direction From event function: " + args.direction);
console.log(args); // [object Object]
console.log(_page); // Page(148)
console.log(this); // undefined
this.swipe(args); // Nothing happen ... no error ...
});
}
swipe(args: gestures.SwipeGestureEventData) {
console.log("Swipe Direction From event function: " + args.direction);
this._router(...
}
我从来没有使用过滑动功能。命令日志中没有错误...
谢谢