typescript

Use firestore's FieldPath.documentId() in within nested object

眉间皱痕 提交于 2021-02-19 08:03:05
问题 This is how my data is structured: So an element has a cluster object and the cluster object has a tags object with one or more tag objects. This is inline with firebase's denormalized data structure Explained here. (We use multi path updates and lookup tables to keep data consistent, this means tags cant be an array!) I would like to query on the document id's of the nested tags object. I know that firestore.FieldPath.documentId() returns the document id and one can use it in a query like so

VueJS Typescript - DOM not updating with variable in Super Class

本秂侑毒 提交于 2021-02-19 07:39:46
问题 Essentially I have a BaseAuthController with on common login functions and variables, I then have a SignupController and a LoginController that inherit from the BaseAuthController. I have looked at the variable through breakpoints and the variables are all being set correctly and they exist. The issue is changing the variable in the super class is not then updating the DOM BaseAuthController.ts import { RouterStates } from './../../../routing/RouterStates'; import Vue from "vue"; export class

How to filter results for range slider with multiple checkbox together in Angular 2?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-19 07:34:11
问题 I am trying to filter results for the given array "db", there are three filters: price, duration, and category. I tried using filter() method to filter results. Here is the link of code which i have tried: https://stackblitz.com/edit/multiple-filters?file=app%2Fapp.component.ts component.html <div class="filters"> <div id="price"> <h3>Price: {{rangeValues[0] + ' - ' + rangeValues[1]}}</h3> <p-slider [(ngModel)]="rangeValues" (click)="handleChange()" [min]="0" [max]="2000" [style]="{'width':

“push()” to an array in Typescript

孤街浪徒 提交于 2021-02-19 07:19:28
问题 I have the following code, to scan for a Bluetooth device, which for every device found, I want to add the device to an array. devices: Observable<Array<string>>; bluetoothAdd() { this.isScanning = true; var plusIcon = this.page.getViewById("add"); plusIcon.style.opacity = 0; var self = this; bluetooth.hasCoarseLocationPermission().then( function (granted) { if (!granted) { bluetooth.requestCoarseLocationPermission(); } else { bluetooth.startScanning({ serviceUUIDs: ["133d"], seconds: 4,

“push()” to an array in Typescript

筅森魡賤 提交于 2021-02-19 07:18:30
问题 I have the following code, to scan for a Bluetooth device, which for every device found, I want to add the device to an array. devices: Observable<Array<string>>; bluetoothAdd() { this.isScanning = true; var plusIcon = this.page.getViewById("add"); plusIcon.style.opacity = 0; var self = this; bluetooth.hasCoarseLocationPermission().then( function (granted) { if (!granted) { bluetooth.requestCoarseLocationPermission(); } else { bluetooth.startScanning({ serviceUUIDs: ["133d"], seconds: 4,

Material-UI 4.8.1 API change - new way to specify the `component` property?

久未见 提交于 2021-02-19 06:49:05
问题 Edit : This was a bug in the typing of 4.8.x, upgrade to 4.9.0+ to fix the issue. On version 4.8.0 , the following code compiles and runs fine: <DialogContent> {/* use a span so we can nest div, p, etc. */} <DialogContentText component="span"> {confirmContent} </DialogContentText> </DialogContent> After upgrading to 4.8.1 the code now fails type-checking with: No overload matches this call. Overload 1 of 2, '(props: DialogContentTextProps, context?: any): ReactElement<any, string | ((props:

typescript push elements into an array in roundrobin fashion

China☆狼群 提交于 2021-02-19 05:56:46
问题 I have an array: public roundRobinMonths: any=['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; and another empty array: public userTimeline: any=[]; My user will select a month from a datepicker and if he selects say September then I want to add months starting from Oct until Sep in my userTimeline array i.e. Oct, Nov,..., Apl, Mai,..., Aug, Sep I receive in my component index for a month that user selects i.e. 0, 1,.., 11. I tried running a for loop like

Failed loading config.ts due to import protractor

筅森魡賤 提交于 2021-02-19 05:48:22
问题 I am trying to start a new protractor project to test an angular site. I installed node.js, typescript, protractor globally and jasmine. I go to the project folder and do webdriver-manager update . Then I do webdriver-manager start . I also build the config.ts using tsc config.ts . Everything works fine until i try protractor config.ts . Here i will provide my config.ts and my package.json. { "name": "protractortests", "version": "1.0.0", "description": "Automated tests for a game platform",

How to merge or groupBy toPromise via RxJs?

僤鯓⒐⒋嵵緔 提交于 2021-02-19 05:39:08
问题 I have the following method that returns result as shown below: result: [ { status: 200, ... }, { status: 200, ... }, { status: 400, ... }, ... ] I need to group the result by using status value and return only 2 results instead of 3 for the example result above: update() { this.demoService.update(...).toPromise() .then(result => { const message = result.map((x: any) => { if (x.status === 200) { return { text: 'successful' }; } else { return { text: 'fail' }; } }); } }) } I tried to use

typescript automatically creating js files after running npm start

╄→尐↘猪︶ㄣ 提交于 2021-02-19 05:35:09
问题 I'm creating an Angular2 app using typescript, and every time I run npm start, all of my .ts files are compiled into javascript files and put in the directory. Is there anyway to turn this off. package.json { "name": "angular-prac", "version": "1.0.0", "scripts": { "start": "concurrent \"npm run tsc:w\" \"npm run lite\" ", "tsc": "tsc", "tsc:w": "tsc -w", "lite": "lite-server", "typings": "typings", "postinstall": "typings install" }, "license": "ISC", "dependencies": { "angular2": "2.0.0