标签: angular2-nativescript

Angular2:将XML转换为JSON

我想将我从Web API响应收到的XML转换为Angular 2中的JSON.该应用程序是在Nativescript中开发的.无法找到解决方案.

typescript angular2-services angular2-nativescript angular

8
推荐指数
2
解决办法
2万
查看次数

Nativescript / TypeScript 错误 - 错误 TS5053:无法使用选项 'inlineSourceMap' 指定选项 'sourceMap'

{
"compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "sourceMap": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "noEmitHelpers": true,
    "noEmitOnError": true,
    "watch": true
},
"exclude": [
    "node_modules",
    "platforms"
],
"compileOnSave": true
}
Run Code Online (Sandbox Code Playgroud)

上面是我的 tsconfig.json 。我收到一个错误,我不明白为什么我会收到。有什么想法吗?

这是我得到的 vscode 调试控制台中的错误

[NativeScriptCli] execute: tns --version
[NSDebugAdapter] Using tns CLI v2.5.0 on path 'tns'
[NSDebugAdapter] Running tns command...
[NativeScriptCli] execute: tns debug ios --no-client --watch 
[NSDebugAdapter] Watching the tns CLI output to receive a connection token
Executing before-prepare hook from /Users/USERNAME/Projects/Project-tns/hooks/before-prepare/nativescript-dev-sass.js
Executing before-prepare hook from /Users/USERNAME/Projects/Project-tns/hooks/before-prepare/nativescript-dev-typescript.js
Found peer …
Run Code Online (Sandbox Code Playgroud)

typescript nativescript visual-studio-code angular2-nativescript

7
推荐指数
1
解决办法
4366
查看次数

类'Subject <T>'错误地扩展了基类'Observable <T> Nativescript导航抽屉错误

#这是我现在面临的错误:

我使用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

7
推荐指数
1
解决办法
1万
查看次数

NativeScript Angular ListPicker 的行为类似于“&lt;select&gt;”

默认情况下,ListPicker会占用大量屏幕空间。有没有办法让它<select>在移动设备上显示时像 HTML 的隐喻一样?

我之前使用过这个 React Native 插件,它正是我想要的隐喻,但是对于 NativeScript。

通过 NativeScript 可以轻松做到这一点吗?我想利用特定于平台的选择隐喻,因此显示/隐藏ListPicker或放入ListPicker模式不是我想要的。

另外,我将有一个相当长的列表,因此操作对话框对我不起作用。

更新:我知道nativescript-drop-down,但是它不使用 webviews 和React Native 插件所做的平台特定的“从选择列表中选择”小部件。

我所说的“从选择列表中选择特定于平台的小部件”是指(来自https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select):

iOS(音符选择器在键盘所在的位置呈现,使用 rolodex 选择器):

Android(注意模式,带有滚动选项列表):

nativescript angular2-nativescript nativescript-telerik-ui nativescript-angular nativescript-plugin

7
推荐指数
1
解决办法
5805
查看次数

Nativescript - 为 Nativescript 插件设置目标 IOS 版本

我最近将我的 xcode 更新为 Xcode12 的测试版,以便我可以看到我的应用程序将如何在即将发布的 IOS 14 版本上运行

尝试运行 TNS RUN IOS 时,出现以下错误:

Saving metadata generation's stderr stream to: /Users/USER/Desktop/Projects/APP/platforms/ios/build/Debug-iphonesimulator/metadata-generation-stderr-x86_64.txt
~/Desktop/Projects/APP/platforms/ios
ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/USER/Desktop/Projects/APP/platforms/ios/internal//NativeScript.framework/NativeScript' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
note: Using new build system
note: Building targets in parallel
note: Using codesigning identity override:
note: Planning build
note: Using build description from disk
warning: The iOS Simulator …
Run Code Online (Sandbox Code Playgroud)

ios nativescript angular2-nativescript nativescript-plugin xcode12

7
推荐指数
1
解决办法
1530
查看次数

NativeScript限制

我正在评估不同的移动框架,我认为nativescript是一个不错的选择.但我不知道开发过程是否存在局限性.例如,我对样式有限制(并不是那么重要),但我想知道将来我是否有限制并且不能使用某些本机功能或外部库.谢谢!

nativescript angular2-nativescript

6
推荐指数
1
解决办法
2580
查看次数

NativeScript:标签上的最大行数

如果我将textWrap="true"添加到标签,文本将被包裹在多行中,到目前为止一切顺利。

但是我有一个很长的字符串,我们的设计只有两行。如何将标签限制为最多两行?

我不想设置高度,因为这会为可以放在一行中的文本留下一个空行?

nativescript angular2-nativescript

6
推荐指数
1
解决办法
2444
查看次数

如何在nativescript中为stacklayout提供border和border-radius

我是nativescript的新手.我不知道如何给stacklayout提供border和border-radius.

下面我发布了我到目前为止所尝试的内容:

component.html:

 <StackLayout class ="stackBorder" orientation="horizontal">
    <Label text="Label 1" width="50" height="50" > </Label>
    <Label text="Label 2" width="50" height="50" > </Label>
    <Label text="Label 3" width="50" height="50" backgroundColor="white"> </Label>
    <Label text="Label 4" width="50" height="50" backgroundColor="white"> </Label>
  </StackLayout>
Run Code Online (Sandbox Code Playgroud)

component.css:

StackLayout {
  margin: 10;
  background-color: green;

}

.stackBorder {
 border: 2px solid red;
   border-radius: 8px;
}
Run Code Online (Sandbox Code Playgroud)

component.ts:

@Component({
    selector: "sdk-child-component",
    moduleId: module.id,
    templateUrl: "./component.html",
    styleUrls: ["./component.css"]
})
Run Code Online (Sandbox Code Playgroud)

最后我无法在stacklayout中看到边框.

css typescript nativescript angular2-nativescript

6
推荐指数
2
解决办法
3486
查看次数

无法读取nativescript angular2中未定义的属性全局数组

我收到了运行时错误cannot read property listArr of undefined.我需要在多个组件中重用相同的数组.这就是我使用Global数组的原因

我添加了相关代码.请检查一下.

Global.ts:

export class Global {

    public static listArr: ObservableArray<ListItem> = new ObservableArray<ListItem>();

}
Run Code Online (Sandbox Code Playgroud)

ts文件:

 Global.listArr.push(data.items.map(item => new ListItem(item.id, item.name, item.marks)));
Run Code Online (Sandbox Code Playgroud)

html文件:

<ListView [items]="Global.listArr"  > </ListView>
Run Code Online (Sandbox Code Playgroud)

typescript nativescript angular2-nativescript angular

6
推荐指数
1
解决办法
691
查看次数

将Angular2材质添加到Nativescript

我使用以下方法创建了一个基本的Nativescript应用程序: tns create my-project-name --template nativescript-angular-drawer-template

现在,我想添加Material Design到我的应用程序.根据文档我运行命令npm install --save @angular/material并根据文档添加MaterialModule.但我的应用程序给出了错误

找到模块功能时出错

任何的想法?

material-design nativescript angular-material2 angular2-nativescript angular

5
推荐指数
1
解决办法
5976
查看次数