标签: angular2-nativescript

NativeScript + Angular:如何安装和使用图标?

我正在尝试在适用于 iOS 和 Android 的NativeScript + Angular应用程序上使用图标。我尝试了不同的方式来设置图标,我使用了本教程,这个解决方案,我什至尝试使用材质插件nativescript-ngx-fonticon

所有这些方法都会给我这个错误

插件 nativescript-fontawesome 不包含在设备 [device-id] 上的预览应用程序中,并且无法工作。

现在,这是我当前的代码:

我的组件.组件.html

<Button text="&#xf810" class="fa" column="0"></Button>

应用程序.css

.fa {
    font-family: 'FontAwesome', fontawesome-webfont;
 }
Run Code Online (Sandbox Code Playgroud)

此外,我的app/fonts文件夹中有以下文件:

fontawesome-webfont.ttf

那么,出了什么问题呢?

谢谢

nativescript angular2-nativescript nativescript-angular angular nativescript-plugin

4
推荐指数
1
解决办法
2356
查看次数

如何隐藏布局和包含的视图

在{N}中,我有一个包含视图的布局,有时会隐藏它 - 即不占用空间.类似于CSS - 显示:无.

我知道可见性:崩溃 - 但它仍占用空间.

我怎样才能做到这一点?

nativescript angular2-nativescript

3
推荐指数
1
解决办法
3185
查看次数

NativeScript-Angular 2自定义AppDelegate

有没有办法实现定制的AppDelegate像一个角2路在NativeScript?我已经看到了在不使用Angular的情况下如何执行此操作的示例,我只是不确定在Angular 2中的哪里注册AppDelegate。

mobile ios nativescript angular2-nativescript angular

3
推荐指数
1
解决办法
728
查看次数

当与addListenerForSingleValueEvent()一起使用时,Firebase返回旧的数据集

我有一次查询,不想保留一个监听器,以便在发送手动触发器时更新数据.

所以我的查询是这样的:

var ref = this.instance.child('/user/manish/today/events')
    .orderByChild('endDateTime')
    .endAt(endEventTime)
    .limitToLast(10)
    .addListenerForSingleValueEvent(this.previousEventListeners);


  this.previousEventListeners = new com.google.firebase.database.ValueEventListener({
      onDataChange: (snapshot) => {
        console.log("Value from native firebase access");
        console.dump(this.testing(snapshot.getValue()));
        let result = {
          value : this.testing(snapshot.getValue()),
          type : "ValueChanged"
        };
        console.dump(result);
      },
      onCancelled: (databaseError) => {
        console.log(databaseError.getMessage());
        hideActivtiyIndicator();
      }
  });
Run Code Online (Sandbox Code Playgroud)

即使添加了与查询条件匹配的新记录,它也会返回相同的数据集.

谢谢

android firebase nativescript firebase-realtime-database angular2-nativescript

3
推荐指数
1
解决办法
1048
查看次数

图像按钮Nativescript和Angular

我需要创建一个图像按钮,其中包含自定义图像和{N} + Angular中的标签.像这样的东西:

在此输入图像描述

这是我的代码.我正在使用网格布局中的堆栈布局.我看不到图像下方的标签.

<GridLayout columns="*,*" rows="*,*,*,*,*,*"  width="400" height="400">
    <StackLayout class="  btn-sq-lg  " col="0" row="0" (tap)="gotoSRTPage()">
        <Image  col="0" row ="1" src="res://ic_briefcase" > </Image>
        <Label class= "label" textWrap="true" col="0" row="2" text="SRT" horizontalAlignment="center" verticalAlignment="center"></Label>
    </StackLayout>  
    <StackLayout class="  btn-sq-lg  " col="1" row="0" (tap)="">
        <Image  col="1" row ="1" src="res://ic_blog" > </Image>
        <Label  class= "label" col="1" row="2" text="SRT" horizontalAlignment="center" verticalAlignment="center"</Label>
        </StackLayout>    
         <StackLayout class="  btn-sq-lg  " col="0" row="3" (tap)="">
        <Image  col="0" row ="4" src="res://ic_reminder" > </Image>
        <Label class= "label" textWrap="true" col="0" row="5" text="SRT" horizontalAlignment="center" verticalAlignment="center"></Label>
        </StackLayout> …
Run Code Online (Sandbox Code Playgroud)

nativescript angular2-nativescript nativescript-telerik-ui

3
推荐指数
2
解决办法
7659
查看次数

Nativescript将LIstPicker与JS对象一起使用

我正在尝试将ListPicker与对象数组一起使用,并且使用所有元素显示[object Object]的标签来呈现列表。

我想指定哪个属性用作列表选择器的“标签”。

不幸的是,Nativescript ListPicker仅接受一个字符串数组,并且我不能使用我的Object数组,因为标签将调用toString()

我发现了基于以下的替代解决方案:https : //github.com/NativeScript/NativeScript/issues/1677

购买我的应用程序时使用的是page-router-outlet,并且不使用元素,因此我无法使用上述建议的方法。在这种情况下,有没有可能将ListPicker与对象数组一起使用,或者有任何不依赖Page元素加载事件的解决方法?

javascript nativescript angular2-nativescript

3
推荐指数
2
解决办法
1226
查看次数

如何在单击angular2本机脚本时打开按钮上的playstore应用程序URL

单击按钮时,我需要在playstore应用程序的帮助下打开playstore应用程序URL。我有来自Playstore的许多应用程序网址。

例如: https //play.google.com/store/apps/details?id = com.ninjakiwi.bftg

应用程序不应在浏览器的帮助下打开。单击按钮时,它必须在官方google playstore应用程序的帮助下打开。

typescript nativescript angular2-nativescript angular

3
推荐指数
1
解决办法
1426
查看次数

删除ListView项目突出显示点击Nativescript Angular iOS

我想删除iOS上ListView上的默认行为 - 突出显示项目.我试着设置背景颜色.它没有成功.我在github上发现了这个问题https://github.com/NativeScript/NativeScript/issues/455 但是我不知道如何在Angular nativescript中实现这一点

listview ios nativescript angular2-nativescript

3
推荐指数
1
解决办法
1493
查看次数

NativeScript找不到Angular组件

我刚开始使用Angular和NativeScript,对于我的生活,我无法弄清楚为什么我无法获得对组件的引用.

首先,我使用以下命令生成初始文件:tns create Test -ng.

接下来,我创建以下文件结构:

App_Resource
components
---app
------app.component.ts
---create
------create.component.ts
------create.component.html
app.module.ts
app.routing.ts
main.ts
Run Code Online (Sandbox Code Playgroud)

这是app.component.ts

import { Component } from "@angular/core";
import { Router } from "@angular/router";
@Component({
    selector: "my-app",
    template: "<page-router-outlet></page-router-outlet>"
})
export class AppComponent { }
Run Code Online (Sandbox Code Playgroud)

这是create.component.ts

import { Component } from "@angular/core";
import { Location } from "@angular/common";
import { Router } from "@angular/router";
import * as AppSettings from "application-settings";
@Component({
    selector: "create",
    templateUrl: "./components/create/create.component.html",
})
export class CreateComponent …
Run Code Online (Sandbox Code Playgroud)

nativescript angular2-nativescript angular

3
推荐指数
1
解决办法
1232
查看次数

Nativescript以编程方式滚动到ScrollView的底部

在我的Nativescript Angular应用程序中,我在ScrollView中有一个TextView,其定义如下:

<ScrollView orientation="vertical" height="70%" width="100%" style="margin-bottom: 1%; background-color:white" (loaded)="onScrollerLoaded($event)">
    <TextView 
        id="terminal" [text]="terminalText" editable="false"
        style="color: whitesmoke; background-color: black; font-size: 8%; font-family: monospace" height="100%"     
        (tap)="onTap($event)" (loaded)="onTerminalLoaded($event)">
    </TextView>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

该元素的作用是充当终端,并快速打印来自蓝牙设备的传入消息。

当前,每当我terminalText向TextView绑定到的变量中添加一些文本时,ScrollView就会滚动回到顶部。我希望能够将ScrollView保留在TextView的底部。


一些注意事项:

我正在terminalText通过此方法向关联的组件类中的变量添加文本:

public appendToTerminal(appendStr){
    this.terminalText += appendStr;
}
Run Code Online (Sandbox Code Playgroud)

我尝试实现以下代码,这些代码将在ScrollView加载后执行:

private scrollIntervalId;
onScrollerLoaded(data: EventData){
    if(!this.scrollIntervalId){
        this.scrollIntervalId = setInterval(()=>{
            this.ngZone.run(() =>
                (data.object as any).scrollToVerticalOffset((data.object as any).scrollableHeight, false)
            )
        }, 10);
    }
}
Run Code Online (Sandbox Code Playgroud)

(此尝试基于此处给出的说明

我只能在Android设备上尝试此操作,因为我无法访问Apple设备。

nativescript angular2-nativescript

3
推荐指数
1
解决办法
2539
查看次数