angular

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

Expected 'styles' to be an array of strings. Angular2

心已入冬 提交于 2021-02-19 05:48:25
问题 I get such error Uncaught Error: Expected 'styles' to be an array of strings. Here is my code styleUrls:[ "../../styles/login.component.styles.scss" ], When I have them declared in the same way but, the file with styles exist in the same directory as the component the problem does not occur. 回答1: I filed an issue for this, which was triaged as workaround 2: non-obvious , priority: 2 (required) , severity 3: broken . I was struggling with something similar while porting an existing angular 2

ForkJoin Issue on angular

隐身守侯 提交于 2021-02-19 05:44:18
问题 I make this code for test forkJoin but it does not work! Can you check what is the problem? const observables = []; observables.push(new Observable(subscriber => subscriber.next('Hello'))); observables.push(new Observable(subscriber => subscriber.next(' '))); observables.push(new Observable(subscriber => subscriber.next('World') )); observables.push(new Observable(subscriber => subscriber.next('!'))); forkJoin(observables).subscribe(word => console.log(word.join(''))); 回答1: Try this const

Injection in Angular 2. How does it work?

随声附和 提交于 2021-02-19 05:40:06
问题 I've been learning Angular 2 for a few days now. When I read about the Injectable() concept in Angular 2 and try to apply the tutorial's example code in this link : Angular 2 - Dependency Injection, I get a problem. They said I need to put the annotation @Injectable() on top of the class so that the other classes can inject, like: import { Injectable } from '@angular/core'; @Injectable() export class appService { getApp(): string { return "Hello world"; } } The problem is that when I drop

ng run project:deploy - Project target does not exist

ぃ、小莉子 提交于 2021-02-19 05:39:46
问题 I have a working production build for Angular Web App. I have an active subscription on my Azure Account (Free Tier) with an AppService Plan, App Service, Resource group, Storage Account, KeyVault, SQL Server & SignalR. I want to deploy my web App using Azure. My Source control is Azure DevOps. I have followed tutorials: https://medium.com/@waelkdouh/deploying-your-angular-application-to-azure-using-azure-devops-f3ba35a0ae4d https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/cd

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

How to use RxJS, MySQL and NodeJS

北城以北 提交于 2021-02-19 05:34:17
问题 I need a with RxJS for MySQL in NodeJS. Could someone give me an example for one select? On front-end I will use Angular2. 回答1: In my case, I'm using the MySQL npm package in a desktop application made with Electron and Angular. However the same should work even on a plain NodeJS application by installing and importing rxjs. I've first installed mysql and @types/mysql package with: npm install --saved-dev mysql @types/mysql Then I've created a MySQL service: import { Injectable } from '

Ng Build an Angular 7 Project in IntelliJ Webstorm or IDEA

北战南征 提交于 2021-02-19 05:27:11
问题 How do I build an Angular CLI project in IntelliJ IDEA or Webstorm? I want an option to run ng build command for my Angular 7 Project, instead of running it through the command prompt. 回答1: To run ng build , open your package.json in IDEA (WebStorm) editor and press the run icon in the gutter to the left of the 'build" script: To run ng serve , run "start" script. Note that the IDE auto-creates the Angular CLI Server run configuration for running ng serve , you can use it to start the app.

Ng Build an Angular 7 Project in IntelliJ Webstorm or IDEA

孤街浪徒 提交于 2021-02-19 05:26:27
问题 How do I build an Angular CLI project in IntelliJ IDEA or Webstorm? I want an option to run ng build command for my Angular 7 Project, instead of running it through the command prompt. 回答1: To run ng build , open your package.json in IDEA (WebStorm) editor and press the run icon in the gutter to the left of the 'build" script: To run ng serve , run "start" script. Note that the IDE auto-creates the Angular CLI Server run configuration for running ng serve , you can use it to start the app.