阅读本机脚本文档并观看我想使用RouterExtensions
的视频,但出现以下错误:
cannot find module nativescript-angular/router or its corresponding type declarations
我的代码
import { Component, OnInit } from '@angular/core';
import { Page } from "tns-core-modules/ui/page";
import { RouterExtensions } from "nativescript-angular/router";
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
constructor( private page: Page,private routerExtensions: RouterExtensions) {
page.actionBarHidden = true;
}
onAccess(){
//log here
}
ngOnInit() {
}
}
答案 0 :(得分:3)
更改: 从“ nativescript-angular / router”导入{RouterExtensions};
进入: 从“ @ nativescript / angular / router”导入{RouterExtensions};
在较新版本的nativescript / angular项目中。
亲切问候