angular5

Angular 5 APP_INITIALIZER gives Cyclic dependency error

我的梦境 提交于 2019-12-11 15:25:29
问题 Angular 5 error. I am having trouble with getting user details on page refresh from browser. I am trying to load the data using APP_INITIALIZER but getting below error - compiler.js:19390 Uncaught Error: Provider parse errors: Cannot instantiate cyclic dependency! ApplicationRef ("[ERROR ->]"): in NgModule AppModule in ./AppModule@-1:-1 Below is my configuration app.module.ts export function initUserFactory(userService: UserService) { return () => { userService.initUser()}; } let INITIAL

if im using lazy loading module my angular application main.bundle.js file size is decreased while build

人走茶凉 提交于 2019-12-11 15:16:23
问题 How can i reduce my vendor.bundle.js and main.bundle.js file size while build my application using ng build --aot false --prod if im using lazy loading module my angular application main.bundle.js file size is decreased while build. 回答1: ng build by itself does not have any optimizations. If you ng build --help you can see all the flags you can pass to further optimize your code and reduce the output sizes. Try ng build -prod -aot -vc -cc -dop --buildOptimizer and see what your numbers are.

spirng boot 2 jwt oauth2 + angular 5 can't get the JWT

独自空忆成欢 提交于 2019-12-11 15:06:35
问题 I'm new working with spring boot and spring security and I'm trying to implement oauth2 to generate a JWT and used this token in an angular5 application, my situation is that after implementation I can get the token if a use postman or curl but when I use my web client in angular I can't get the token. this is what I did. My login method is angular login(username: string, password: string ) { const params: HttpParams = new HttpParams(); const headers: Headers = new Headers(); params.set(

Quill editor not firing (change) event in Angular

牧云@^-^@ 提交于 2019-12-11 14:55:09
问题 I'm using Quill editor with the ngx-quill NPM package. Everything is working great except that I just can't get the (change) event to fire. Here's the HTML: <quill-editor (change)="validateChange(field)" [formControlName]="field.id" [id]="field.id"></quill-editor> The (change)="validateChange(field)" is having no effect. Thanks for any ideas!! 回答1: In model driven form you could use valueChanges Observable on your form. this.formName.valueChanges.subscribe(data => { console.log('Changed

Angular 5 pass headers properly in http get requests

送分小仙女□ 提交于 2019-12-11 14:51:42
问题 so initially i was using the deprecated HttpModule for my api requests but i'm using the HttpClientModule now and having issues with passing headers correctly. i've got a function that calls api to get some data...this is what i had initially with HttpModule service.ts export class userService { //using HttpModule getCurrentProfile() { let v = this.page_header(); return this.http.get(this.userProfileUrl, {headers: headers}) .toPromise() .then(response => response.json()) .catch(this

How to draw connector lines between shapes by dragging mouse in FabricJS

天涯浪子 提交于 2019-12-11 14:23:19
问题 I'm trying to build a state machine kind of flow diagram using Fabric js. So far I'm able to dynamically add shapes and just draw lines between fixed points. I'm stuck at drawing connector lines between shapes by dragging the mouse from one component to another. Is it really possible using FabricJS? if yes, what are the approaches? Can anyone throw some light on this? Here is what I have so far, import { Component } from '@angular/core'; import 'fabric'; declare let fabric; @Component({

npm start does not work in angular 5 anymore [duplicate]

别等时光非礼了梦想. 提交于 2019-12-11 11:51:21
问题 This question already has answers here : Angular CLI gives me “TypeError: callbacks[i] is not a function” when I “ng serve” (12 answers) Closed last year . I'm trying to run npm start for angular 5 and I get the following error TypeError: callbacks[i] is not a function Does anyone know where this comes from? It just appeared out of nowhere... There seems nothing to be wrong with my project (code) 回答1: Temporary fix: Rollback the bugged dependency. npm install copy-webpack-plugin@4.3.0 More

Angular, test which component is instantiate when navigate with router

孤街浪徒 提交于 2019-12-11 11:20:10
问题 I'd like to know if there is a way to test which component is instantiate when navigating to a route. I have this route : const routes: Routes = [{path: ':anyString', component: AnyStringComponent}]; I want to test with unit-test : router.navigate(['azdfz4896']); // expect instantiated component to be AnyStringComponent Is there a way to test that ? 回答1: you can mock ActivatedRoute and try : route.snapshot._routeConfig.component.name to get the component name from snapshot ActivatedRoute mock

Icon not showing when creating embedded view

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 10:30:23
问题 I am having this layout, inspired by this example, which lets components decide how the header looks like: <div class="main" [@applicationTransition]="applicationState" fxLayout="column" fxFlexFill> <nav class="header" [@headerTransition]="applicationState"> <ng-container #vcr></ng-container> </nav> <main class="content" fxLayout="column" fxFlex style="overflow: hidden; height: 100%"> <router-outlet #o="outlet" fxLayout="column" fxFlex></router-outlet> </main> </div> However, it seems that

Save the log in electron devtools to a file

只愿长相守 提交于 2019-12-11 09:45:26
问题 I am working on Electron app with angular 5 for the rendering process, is there is a way to export the console programmatically? I need a way to synchronize the logging data to file so, I can review it anytime without opening electron devtools and save as option, I need it programmatically I save my own logs, but what if there is a module that logging an error i need to get whole console log history and export it to log file 回答1: You can use electron-log , which is a logging module for