无法使用 NativeScript + Angular-2 项目访问本机 api(iOS 或 Android)
Cannot access native api (iOS or Android) using NativeScript + Angular-2 project
如何复制:
tns 创建东西 --ng
cd 东西
现在关注这个linkhttps://docs.nativescript.org/angular/core-concepts/accessing-native-apis-with-javascript.html
npm 安装 tns-platform-declarations --save-dev
替换了 tsconfig.json 和 reference.d.ts
的内容
tns 运行 iOS
我得到
file:///app/tns_modules/@angular/compiler/bundles/compiler.umd.js:18646:26: JS ERROR Error: Can't resolve all parameters for ItemsComponent: (?).
ts 版本 2.1.6
xcode 版本 8.2.1
"tns-platform-declarations": "^2.5.0",
"tns-ios":{"version":“2.5.0”}
"nativescript-angular": "1.4.0",
没有这些修改,iOS 项目 运行 是预期的。
我认为它有参考文献,但我不确定。
在Angular-2启用的项目中工作时需要处理一些DOM相关类型。这将在 nativescript-dev-typescript 的下一版本中处理,但与此同时,请在 references.d.t.s
中使用以下内容
// <reference path="./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
declare type Comment = any;
declare type CloseEvent = any;
declare type Document = any;
declare type DocumentFragment = any;
declare type Element = any;
declare type History = any;
declare type HTMLAnchorElement = any;
declare type HTMLCollection = any;
declare type HTMLDocument = any;
declare type HTMLElement = any;
declare type HTMLInputElement = any;
declare type HTMLScriptElement = any;
declare type HTMLStyleElement = any;
declare type KeyboardEvent = any;
declare type Location = any;
declare type MessageEvent = any;
declare type MouseEvent = any;
declare type Node = any;
declare type NodeList = any;
declare type Text = any;
declare type WebSocket = any;
如何复制:
tns 创建东西 --ng
cd 东西
现在关注这个linkhttps://docs.nativescript.org/angular/core-concepts/accessing-native-apis-with-javascript.html
npm 安装 tns-platform-declarations --save-dev
替换了 tsconfig.json 和 reference.d.ts
的内容tns 运行 iOS
我得到
file:///app/tns_modules/@angular/compiler/bundles/compiler.umd.js:18646:26: JS ERROR Error: Can't resolve all parameters for ItemsComponent: (?).
ts 版本 2.1.6
xcode 版本 8.2.1
"tns-platform-declarations": "^2.5.0",
"tns-ios":{"version":“2.5.0”}
"nativescript-angular": "1.4.0",
没有这些修改,iOS 项目 运行 是预期的。
我认为它有参考文献,但我不确定。
在Angular-2启用的项目中工作时需要处理一些DOM相关类型。这将在 nativescript-dev-typescript 的下一版本中处理,但与此同时,请在 references.d.t.s
中使用以下内容// <reference path="./node_modules/tns-core-modules/tns-core-modules.es2016.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
declare type Comment = any;
declare type CloseEvent = any;
declare type Document = any;
declare type DocumentFragment = any;
declare type Element = any;
declare type History = any;
declare type HTMLAnchorElement = any;
declare type HTMLCollection = any;
declare type HTMLDocument = any;
declare type HTMLElement = any;
declare type HTMLInputElement = any;
declare type HTMLScriptElement = any;
declare type HTMLStyleElement = any;
declare type KeyboardEvent = any;
declare type Location = any;
declare type MessageEvent = any;
declare type MouseEvent = any;
declare type Node = any;
declare type NodeList = any;
declare type Text = any;
declare type WebSocket = any;