angular2-nativescript

In NativeScript with Angular2 get element value

北战南征 提交于 2019-12-20 05:39:16
问题 I have a list, and I want to get the value of the list item. The view is as follows <ListView [items]="myItems" (itemTap)="onItemTap($event)"> <template let-item="item" let-i="index" let-odd="odd" let-even="even"> <StackLayout [class.odd]="odd" [class.even]="even"> <Label #myFoo id="grocery-list" [text]='"Value is: " + i'></Label> </StackLayout> </template> In typescript I have the following import { Component,ViewChild,ElementRef } from "@angular/core"; import {topmost} from "ui/frame";

NativeScript - Filter a ListView data by tabs from TabView-ng

会有一股神秘感。 提交于 2019-12-13 22:08:22
问题 How can I show up by demand only data related by specific room? Below my Json data: { "rooms": [ { "id": 1, "name": "Room 01", "content": "Content 01" }, { "id": 2, "name": "Room 02", "content": "Room 02" } ], "tables": [ { "id": 1, "number": 1, "roomId": 1 }, { "id": 2, "number": 2, "roomId": 1 }, { "id": 3, "number": 3, "roomId": 2 } ] } My template: <TabView [(ngModel)]="tabSelectedIndex" selectedColor="#FF0000"> <ng-container *ngFor="let tab of roomsList"> <StackLayout *tabItem="{title:

Issues changing the background colour of the currently selected item in a ListView - Nativescript/Angular2

喜你入骨 提交于 2019-12-13 11:09:07
问题 I am busy with a Nativescript/Angular2 app where I display a list of active stock takes in a ListView. I am trying to change the background color lf the current selected stock take item in the ListView to show the currently selected StockTake. I add the css class to the StackLayout inside the ng-template but for some reason the css isn't applied when I tap on a item. Any idea what could be going wrong here/how I can fix this? I don't get any errors so i'm completely lost as to what the issue

Use Nativescript Core plugin in Nativescript Angular project

一个人想着一个人 提交于 2019-12-13 04:45:55
问题 I am using in my Nativescript Angular app the nativescript-google-maps-sdk plugin which works great. My issue is that I want to use cached images to display in a custom InfoWindow. For this purpose I am using the nativescript-web-image-cache plugin app-wide. When I use the regular <WebImage> tag in the infoWindow it complains that it is not a registered component: Module 'ui/web-image' not found for element 'WebImage' Everywhere else in the app it works just fine. In this issue is it

Databinding from within a template in angular

可紊 提交于 2019-12-13 03:52:50
问题 In a component how to databind two-way for the following example: I want the button's text to toggle automatically when I am setting or unsetting dataitem.isSelected in the respective methods Here is the code of channelstab.component.ts @Component({ selector: 'channels-tab', template: ` <ListView [items]="channels$ | async" class="list-group"> <ng-template let-dataitem="item"> <Button [text]="dataitem.isSelected?'UnFollow':'follow'" (tap)="dataitem.isSelected?unfollow(dataitem):follow

Nativescript unable to get values of Textfield element using angular 6

馋奶兔 提交于 2019-12-13 03:45:04
问题 NativeScript version 4.2.4 Angular version 6.0 I have two TextFields in my login page <StackLayout class="input-field"> <TextField class="input" hint="Username" autocorrect="false" autocapitalizationType="none" [(ngModel)]="user.userName" returnKeyType="next" (returnPress)="focusPassword()"></TextField> <StackLayout class="hr-light"></StackLayout> </StackLayout> <StackLayout class="input-field"> <TextField #password class="input" hint="Password" secure="true" [(ngModel)]="user.password"

Sort nested observable

社会主义新天地 提交于 2019-12-13 00:46:45
问题 I have here a JSON file which looks like this: [ { "question": "What is your age range?", "options": ["10-20","20-30","30-40","40-50"] }, { "question": "How did you find us?", "options": ["Friend recommendation","Google","Other"] }, { "question": "Are you interested in etcetc?", "options": ["No","Yes","Meh"] } ] In my project I've got a model with the same structure which looks like this: export interface Test { question: string; options: string[]; } in my service file, I read the file like

How to add a side menu with NativeScript + Angular 2 project?

折月煮酒 提交于 2019-12-12 19:14:26
问题 i'm whiling to know how to add a side menu on my current NativeScript + Angular 2 project, I know that has a side menu template, but i started it as blank project and i'm wonder how to add this feature. 回答1: You will want to use Telerik UI for NativeScript (https://www.npmjs.com/package/nativescript-telerik-ui), please refer to this guide on how to integrate: http://docs.telerik.com/devtools/nativescript-ui/Controls/Angular/SideDrawer/getting-started You can see an example of how to wire it

Nativescript / TypeScript error - error TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'

冷暖自知 提交于 2019-12-12 11:18:19
问题 { "compilerOptions": { "module": "commonjs", "target": "es5", "sourceMap": true, "experimentalDecorators": true, "emitDecoratorMetadata": true, "noEmitHelpers": true, "noEmitOnError": true, "watch": true }, "exclude": [ "node_modules", "platforms" ], "compileOnSave": true } Above is my tsconfig.json . I'm getting an error that I'm not understanding why i'm getting. any thoughts? Here's the errors in debug console in vscode i'm getting [NativeScriptCli] execute: tns --version [NSDebugAdapter]

Filter ListView using angular2 in NativeScript

不羁的心 提交于 2019-12-12 05:38:42
问题 I am new to nativescript and angular2. I want to filter listview using textfield input entered by user. in angular version 1, we used to do it like <input type="text" ng-model="userinput"> <div ng-repeat="x in items | filter : userinput"> </div> how can i do this using angular2 in nativescript? my listview is: <ListView [items]="myItems" class="list-group"> <template let-item="item"> <StackLayout> <Label [text]='item.Department' class="list-group-item"></Label> </StackLayout> </template> <