angular5

RxJS Observables does not display data on subscribe or async

≯℡__Kan透↙ 提交于 2019-12-13 03:31:24
问题 I am trying to get all the data from firestore - collection and subcollection into an observable form of array and display it with async pipe. availableCategoriesCollection: AngularFirestoreCollection<Category>; availableCategories$: Observable<CategoryId[]>; lstCategories: Observable<any>; this.availableCategoriesCollection = this.httpDataService.getAllCategories(); this.availableCategories$ = this.availableCategoriesCollection.snapshotChanges().map(data => { return data.map(record => {

Component cannot subscribe to data source

社会主义新天地 提交于 2019-12-13 02:58:01
问题 I have this component listening for messages from a service. Note that every console.log() statement shown below is hit at least once, everything gets logged. That is, except "adding message to array" - that does not get logged, but it should get logged! Here is the component: import {Component, OnInit, Inject} from '@angular/core'; import {ChromeDataService} from '../../../../shared/services/events'; @Component({ providers: [ChromeDataService], selector: 'app-events-list', templateUrl: '.

ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)

依然范特西╮ 提交于 2019-12-13 01:20:03
问题 I have the following code: import { Injectable } from '@angular/core'; @Injectable() export class ClientCacheService { private _cacheMode: CacheMode; private _cacheMode: CacheMode; constructor(cache?: CacheMode) { if(!cache) this._cacheMode = CacheMode.SessionStorage; else this._cacheMode = cache; } setToCache(key :string, prefix:string, definition: any) { if(this._cacheMode === CacheMode.SessionStorage) window.sessionStorage.setItem(`${prefix}_${key}`, JSON.stringify(definition)); else if

Import single lodash functions for libraries with aot

亡梦爱人 提交于 2019-12-13 00:42:59
问题 I'm trying to use lodash with the syntax "import * as includes from 'lodash.includes';" so i don't need to install all lodash library and just the functions that I need. Everything works fine but aot. I build my library to use it in other project as a node_modules and when I do ng serve everything works fine but when doing ng serve --aot I got: "Module not found: Error: Can't resolve 'lodash.includes' in etc...". I could solve the problem by installing lodash in my library project and use it

RangeError: Maximum call stack size exceeded Angular 5 Router

人走茶凉 提交于 2019-12-12 21:01:30
问题 Hey I've just tried to set up lazy loading of modules in my application but I'm getting this error I was following a tutorial but obviously they didnt get the same errors my set up is as follows app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { RouterModule, Routes, ActivatedRoute, ParamMap } from '@angular/router'; import { HttpClientModule } from '@angular/common/http'; import { environment } from '../environments

This command can only be run inside of a CLI project

。_饼干妹妹 提交于 2019-12-12 19:24:46
问题 For some reasons, I want to use Angular v5 if I run the below command,it builds an app in angular 6 which I don't want. ng new hello //this creates angular app in the latest version I ran the command in the below order npm init //generated package.json The above command generated package.json file, I swapped the content of package.json file. https://jsoneditoronline.org/?id=5acc3c072e164c4a8235152516e44f54 npm install //installed all the node modules now when I run command to generate the

DWT Java Script Library Progress Dialogue Automatically Displays with Angular 5

自闭症网瘾萝莉.ら 提交于 2019-12-12 19:22:42
问题 I am incorporating the Dynamic Web Twain javascript library into my angular application to allow my end users to scan using a web browser instead of a desktop application. Upon loading the page, the progress bar immediately pops up. This is not expected behavior, nor does it happen when I use angular 4. I am using angular 5 at work. It also makes no difference which browser I use (IE, Chrome, Firefox). The version of my Angular is: > Angular CLI: 1.6.6 Node: 9.4.0 OS: win32 x64 Angular: 5.2.3

Angular 5 - Dynamic component loader - Cannot read property 'viewContainerRef' of undefined

☆樱花仙子☆ 提交于 2019-12-12 14:39:43
问题 I am trying to make the dynamically load components in Angular 5. I use the Angular Guide for this, but I am stuck now. The thing is; I get the following error: ERROR TypeError: Cannot read property 'viewContainerRef' of undefined The error is in my ChecklistComponent at const viewContainerRef = this.appHost.viewContainerRef; For some reason appHost is undefined and I have no idea why. Here is the rest of my code: checklist.component.ts import { AfterViewInit, Component,

How to place “mat-toolbar” on top of “mat-sidenav” Angular Material 5

扶醉桌前 提交于 2019-12-12 13:42:35
问题 I'm writing here since I have a question about Mat Toolbar and Mat-sidenav from Angular Material. I'm trying to get the Sidenav to go under the toolbar and the toolbar always occupies the top part, something like this: Example Here´s my code: <mat-sidenav-container class="sidenav-container" autosize> <mat-sidenav #drawer class="sidenav" fixedInViewport="true" [attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'" [mode]="(isHandset$ | async) ? 'side' : 'push'" [opened]="(isHandset$ |

angular 5 adal.js automatic token renew in load angular twice or more

谁说胖子不能爱 提交于 2019-12-12 13:26:08
问题 I have tried a number of angular-adal libraries but the renew of the token is not automatic done. This the configuration I used. In package.json "@types/adal": "^1.0.29", "@types/adal-angular": "^1.0.0", "adal-angular": "^1.0.17", adal-angular come with two scripts adal.js and adal-angular.js . I think adal.angular.js is only for old angularjs solutions. So I used adal.js and an wrapper @types/adal. and include the adal.js in the .angular-cli.json "scripts": [ "../node_modules/adal-angular