angular7

Angular 7 - service worker not registered

跟風遠走 提交于 2019-12-03 15:43:32
问题 I did everything as written in "https://angular.io/guide/service-worker-getting-started" to make my application PWA. Used exactly this commands: ng add @angular/pwa npm install http-server -g ng build --prod http-server -p 8080 -c-1 dist Then I opened this url on Chrome (in incognito) http://127.0.0.1:8080 When I open tools for developers (f12) > Applications > Service Workers there is no service worker available and website don't work when I set offline there. Additional info about my

Angular 7 routerLink directive warning 'Navigation triggered outside Angular zone'

十年热恋 提交于 2019-12-03 10:21:35
I am struggling with Angular framework to get my application run smoothly, but I can't resolve an issue with routing. I have a top level AppComponent and app-routing.module.ts which manage the navigation via my custom SlideMenuComponent . My simplified html template of AppComponent : <app-slide-menu [buttons]="menuButtons"></app-slide-menu> <router-outlet></router-outlet> My SlideMenuComponent has the following html as its core: <nav><div *ngFor="let button of buttons"> <a routerLink="{{button.routerLink}}" >{{button.name}}</a> </div></nav> A user can navigate to '/courses' through this slide

WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 \"export 'ɵɵdefineInjectable' was not found in '@angular/core'

淺唱寂寞╮ 提交于 2019-12-03 09:58:15
I am using ng2-charts in Angular 7 app and having warning WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export 'ɵɵdefineInjectable' was not found in '@angular/core' error in VS Code error in browser What could be the reason and how to resolve it? ng2-charts v2.2.4 has this bug as lots of users are reporting that so down-grading to ng2-charts v2.2.3 is fine until it is fixed in the future releases. npm install ng2-charts@2.2.3 来源: https://stackoverflow.com/questions/56371427/warning-in-node-modules-ng2-charts-fesm5-ng2-charts-js-23054-72-export-%c9%b5%c9%b5de

Loop array and return data for each id in Observable

两盒软妹~` 提交于 2019-12-03 08:57:56
Using RxJS v6 is challenging to retrieve data from sub collection for every item in the loop. There is no way to iterate throw array that is retrieved from HTTP call. Merge map does it only for single item where there is a requirement to do it on all array items. I've been stuck on this for 3 days. I've tried everything. Problem is that new pipe syntax while provides you with neat way to organise code there is no easy way to loop throw collection of data. It is impossible to use map javascript function as it is outside observable and items returned are undefined. On internet I could only find

how to show loading indicator on page loading in angular 7 until all apis response?

谁都会走 提交于 2019-12-03 08:49:53
I have 5 api calls in a page. some apis take 20 sec to give response. some take 30 sec to give response. some take 10 sec so, when first api gives its response, first api sets loading indicator false. then loading indicator disppears. But other apis are still working I want to show loading indicator until the five api calls response. can you please give me some idea to do the task. code: component.ts loading = true; ngInit() { this.api1(); this.api2(); this.api3(); this.api4(); this.api5(); } api1(){ this.loading=true; this.apiService.api1.subscribe(response => { loading = false; }, error=>{ }

Angular CLI HMR with Lazy-Loaded routes hot-reloads the whole thing

好久不见. 提交于 2019-12-03 03:25:33
问题 (Confirmed an issue even with Angular 7). Let's get this fixed! I'm using HMR as set up here: https://github.com/angular/angular-cli/wiki/stories-configure-hmr from a fresh ng new build. If I change any component and make it lazy loaded, angular HMR will hot-reload everything, making the page sync slower. I know this because it's by default set-up to console.log every module that is being reloaded, and when I'm using a lazy route, it logs everything. But when I change that component to non

Angular 7 Drag and Drop - Dynamically Create Drop Zones

大城市里の小女人 提交于 2019-12-03 03:17:18
Is there a way to dynamically create drop zones? I'm having some troubles with ngFor and cdkDropList. Here is my first list and draggable elements: <div class="subj-container" cdkDropListOrientation="horizontal" cdkDropList #subjectList="cdkDropList" [cdkDropListData]="subjects" [cdkDropListConnectedTo]="[lessonList]" (cdkDropListDropped)="drop($event)" > <div class="subject" *ngFor="let subject of subjects" cdkDrag> {{subject.name}} </div> </div> And here is my second list: <div class="conta" cdkDropList #lessonList="cdkDropList" [cdkDropListData]="appointment.lessons" [cdkDropListConnectedTo

Errors: Data path “.builders['app-shell']” should have required property 'class'

做~自己de王妃 提交于 2019-12-02 18:40:24
I am getting this error while running my application. Here are the details of my application. I have already tried cache clean. idirene youcef In your package.json change the devkit builder. "@angular-devkit/build-angular": "^0.800.1", to "@angular-devkit/build-angular": "^0.10.0", it works for me. good luck. Following worked for me npm uninstall @angular-devkit/build-angular npm install @angular-devkit/build-angular@0.13.0 Your @angular-devkit is incompatible with @angular/cli version, so just install older one like this for example: npm install @angular-devkit/build-angular@0.13.8 @angular

Angular CLI HMR with Lazy-Loaded routes hot-reloads the whole thing

╄→гoц情女王★ 提交于 2019-12-02 16:55:47
(Confirmed an issue even with Angular 7). Let's get this fixed! I'm using HMR as set up here: https://github.com/angular/angular-cli/wiki/stories-configure-hmr from a fresh ng new build. If I change any component and make it lazy loaded, angular HMR will hot-reload everything, making the page sync slower. I know this because it's by default set-up to console.log every module that is being reloaded, and when I'm using a lazy route, it logs everything. But when I change that component to non-lazy-loaded, it logs only a few small components. Therefore, when I'm using HMR and lazy routes, my app

Rxjs catchError not working when subscribe after pipe

吃可爱长大的小学妹 提交于 2019-12-02 13:32:46
I have created an observable to consume an API Observable:- return this.http.post('/api/ApplicationUser/Login', loginDetails, httpOptions).pipe( map((result: any) => { localStorage.setItem('jwtToken', result.jwtToken); localStorage.setItem('refreshToken', result.refreshToken.value) localStorage.setItem('UserName', result.userName); return result; }), catchError((err: any) => { //this.userLogout() console.log('refresh error') return throwError(err); }) ); } Above code is working fine by results or throwing errors according to my situations when Iam activating with below code:- this.loginService