如何在驻留在应用程序中的页面之间共享数据.任何人都可以在nativescript中讲述localstorage吗?
我只是想安装NavtiveScript,为此,我按照官方安装指南进行操作
http://docs.nativescript.org/angular/start/quick-setup but I am stuck at "Step 3: Install iOS and Android requirements"
当我在命令提示符中运行以下命令时(具有管理权限)
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
Run Code Online (Sandbox Code Playgroud)
一切似乎安装没有任何问题.但是当我尝试通过命令验证安装时,"tns doctor"我返回以下警告:
D:\>tns doctor
WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies …Run Code Online (Sandbox Code Playgroud) 我正在设置一个NativeScript-Angular项目,并想使用Jasmine-Karma实现单元测试,以便使用css选择器测试我的组件。如何为一个简单的组件设置一个简单的单元测试(除了官方存储库中提供的样本测试之外)?
这是针对使用带有Android API级别28的NativeScript CLI 6.0的新项目的。
我已经尝试使用常规的Angular TestBed,据称此博客文章支持它:https ://www.nativescript.org/blog/announcing-the-nativescript-4.1-release
我还尝试在官方nativescript-angular存储库上遵循他们的工作测试:https : //github.com/NativeScript/nativescript-angular/tree/master/tests
无论哪种方式,在尝试执行自己的实现时,我似乎都在做错事,因为出现以下错误:
Uncaught Error: Zone already loaded
TypeError: Cannot read property 'injector' of null
TypeError: Cannot read property 'getComponentFromError' of null
TypeError: Cannot read property 'currentPage' of undefined
有没有人设法让Jasmine-Karma在NativeScript中使用TestBed单元测试?
test-main.ts
import "nativescript-angular/zone-js/testing.jasmine";
import { nsTestBedInit } from "nativescript-angular/testing";
nsTestBedInit();
Run Code Online (Sandbox Code Playgroud)
example.ts
import { ItemsComponent } from '~/app/item/items.component';
import { By } from '@angular/platform-browser';
import { nsTestBedBeforeEach, nsTestBedAfterEach, nsTestBedRender } from 'nativescript-angular/testing';
describe('item-detail-component', () => {
beforeEach(nsTestBedBeforeEach(
[ItemsComponent] …Run Code Online (Sandbox Code Playgroud) 我正在学习NativeScript.作为这项工作的一部分,我正在尝试创建一个向用户显示对话框的页面.当用户单击按钮时,我需要向他们显示一个对话框,允许他们输入两个值(名字和姓氏).
NativeScript中的对话框模块提供了几个内置选项.但是,据我所知,这些选项都不允许您创建一个显示两个字段的对话框.如何在NativeScript中创建一个对话框,允许我提示用户输入名字和姓氏?目前,我的页面如下所示:
page.xml
<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageLoaded">
<GridLayout rows="auto, *">
<Border borderWidth="1" borderColor="#000" width="28" height="28" cornerRadius="14" tap="addPersonButton_Tap">
<Label text="add person" />
</Border>
</GridLayout>
</Page>
Run Code Online (Sandbox Code Playgroud)
page.js
var viewModel = new MyPageViewModel();
function pageLoaded(args) {
var page = args.object;
page.bindingContext = viewModel;
}
exports.pageLoaded = pageLoaded;
function addPersonButton_Tap(args) {
console.log('new person');
/*
* Dialog open code goes here. Yet, the following definitaly is not correct.
dialogs.prompt({
title: "Add New Person",
message: "First Name",
okButtonText: "Save",
cancelButtonText: "Cancel",
inputType: dialogs.inputType.text …Run Code Online (Sandbox Code Playgroud) 如何获取本地大json数据?
我试过这个,但我没有成功:
var sa = require("./shared/resources/sa.json");
var array = new observableArrayModule.ObservableArray(sa);
Run Code Online (Sandbox Code Playgroud) #这是我现在面临的错误:
我使用npm(https://github.com/shripalsoni04/nativescript-angular-drawer-template)下载了导航抽屉样本.但它会出现以下错误.
dhrn@dhrn-Inspiron-5548:~/NativeApp/Supervisor$ tns run android
Searching for devices...
iTunes is not available for this operating system. You will not be able to work with connected iOS devices.
Executing before-prepare hook from /home/dhrn/NativeApp/Supervisor/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 2.4.1
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
Types of property 'lift' are incompatible.
Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
Type 'Observable<T>' is not assignable to type 'Observable<R>'.
Type …Run Code Online (Sandbox Code Playgroud) typescript nativescript angular2-nativescript nativescript-telerik-ui
我想在NativeScript的Absolute Layout中将元素放在屏幕的底部.
我有这个代码:
<AbsoluteLayout>
<maps:mapView
left="0"
top="0"
width="100%"
height="100%"
latitude="{{ map.latitude }}"
longitude="{{ map.longitude }}"
zoom="{{ map.zoom }}"
padding="{{ map.padding }}"
mapReady="onMapReady"
coordinateTapped="onCoordinateTapped"
markerSelect="onMarkerSelect"
shapeSelect="onShapeSelect"
cameraChanged="onMapCameraChanged"/>
<ScrollView
left="0"
top="0"
width="100%"
orientation="horizontal">
<!-- More XML -->
</ScrollView>
<StackLayout
left="0"
bottom="0"
width="100%"
visibility="visible"
orientation="horizontal"
style="background-color: red;">
<Label text="TITLE"></Label>
</StackLayout>
</AbsoluteLayout>
Run Code Online (Sandbox Code Playgroud)
我发现AbsoluteLayout没有底层属性......这是我想要创建的图片:
那么如何排列图片中的项目,特别是底部的项目?
编辑:我应该注意,这个底部矩形的尺寸可能不一定相同....
我需要创建一个窗口对象,以便在iframe中加载的外部文件可以调用nativescript函数.
我特别需要窗口对象,因为我加载的文件可以是符合LMS的符合(SCORM)的任何文件.
谢谢
编辑:我加载的文件是符合SCORM的文件.他们搜索window.API对象/ window.parent.API等,以便开始与已加载它们的容器进行通信.我不能改变那个文件.
告诉我是否需要更多细节.
我有一个Nativescript应用程序,我正在使用VS Code进行开发,当我尝试使用Nativescript扩展的Nativescript启动配置运行它时没有问题,当我使用连接USB的真实设备或当我使用其中一个android-sdk模拟器.
现在我需要在机器上运行Hyper-V,并且当虚拟机管理程序打开时,这些模拟器无法运行.所以我下载并安装了Visual Studio Android Emulator,它在我手动启动时运行正常.
问题是nativescript项目无法使用tns设备或adb设备命令识别此设备,如果我尝试从VS Code启动应用程序,它会尝试启动其他模拟器之一,这显然会因管理程序/ Intel而失败Haax不兼容.
你们之前有没有遇到过这个问题并且有任何可以分享的解决方案吗?
谢谢.
android-emulator nativescript visual-studio-code visual-studio-emulator
我想id='item'在创建图像元素。
我似乎在Google上找不到任何东西。互联网上的大多数教程都使用Typescript,并且始终以page=args.object
export function pageLoaded(args) {
page = args.object;
item = page.getViewById("item");
}
Run Code Online (Sandbox Code Playgroud) nativescript ×10
javascript ×2
angular ×1
iframe ×1
json ×1
testbed ×1
typescript ×1
vue.js ×1
xml ×1