forkJoin and interceptor together not working

I use forkJoin for multiple requests. It was working well. However after I added interceptor, it stopped working. intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { const token = localStorage.getItem(‘token’); if (token) { request = request.clone({ url: request.url, setHeaders: { Authorization: `Bearer ${token}`, ‘Access-Control-Allow-Origin’: ‘*’ } }); return next.handle(request); } else { this.router.navigate([‘/login’]); return next.handle(request); } } […]

I already got environment by useFactory, then how to pass value per environment to AppModule?

I have AppModule in angular 11 project. @NgModule({ declarations: [ AppComponent, HomeComponent, ProfileComponent ], imports: [ BrowserModule, AppRoutingModule, MsalModule.forRoot( new PublicClientApplication({ auth: { clientId: ‘Enter_the_Application_Id_here’, authority: ‘Enter_the_Cloud_Instance_Id_Here’ redirectUri: ‘Enter_the_Redirect_Uri_Here’ }, cache: { cacheLocation: ‘localStorage’, storeAuthStateInCookie: isIE, // Set to true for Internet Explorer 11 } }), null, null) ], providers: [MyAppConfig, { provide: APP_INITITALIZER, useFactory: […]

By Hello
Published
Categorized as angular, typescript Tagged ,

How to pass clientId in different environment to AppModule

I use msal to do authentication. In my AppModule.ts (from the example) @NgModule({ declarations: [ AppComponent, HomeComponent, ProfileComponent ], imports: [ BrowserModule, AppRoutingModule, MsalModule.forRoot( new PublicClientApplication({ auth: { clientId: ‘Enter_the_Application_Id_here’, // This is your client ID authority: ‘Enter_the_Cloud_Instance_Id_Here’/’Enter_the_Tenant_Info_Here’, // This is your tenant ID redirectUri: ‘Enter_the_Redirect_Uri_Here’// This is your redirect URI }, cache: { cacheLocation: […]

By Hello
Published
Categorized as angular, angular11, msal, msal-angular Tagged , , ,

Angular Mat-Table how to span the header row

I want to use multiple header rows in Mat Table. I can span the columns but failed on spanning on the row. Please see my stackblitz demo I want the last column "Cost" across the rows. But I can’t get rid of the extra ‘cost" column like in the image. Source: Angular Material Quesions

By Hello
Published
Categorized as angular, angular-material Tagged ,

gantt chart plot wrong date on xAxis

I want to display the progress in year in 2021. So the start point is 2021-1-1, and the end point is 2021-12-31. The main code is: xAxis: { min: Date.UTC(2021, 1, 1), max: Date.UTC(2021, 12, 31) }, However it plots from Feb, 2021 to Jan, 2022. Please see the Stackblitz demo. Source: Angular Questions

By Hello
Published
Categorized as angular, gantt-chart, highcharts Tagged , ,

Can I hide the ‘highchart.com’ text from my angular application?

I want to use highchart for free in my angular application. It is just a simple gantt chart. Here is the Demo on Staclblitz How can I remove the text highlighted for free? If not, any other ways to plot a gantt chart? Source: Angular Questions

By Hello
Published
Categorized as angular, gantt-chart, highcharts Tagged , ,

How to make the whatsapp icon visible in small screen?

I have a nar bar, the left side is navigation items and the right side is a whatsapp icon. <mat-toolbar class="nav"> <a routerLink="app-aaa" mat-button>aaa</a> <a routerLink="app-bbb" mat-button>bbb</a> <a routerLink="app-ccc" mat-button>ccc</a> <a routerLink="app-ddd" mat-button>ddd</a> <a routerLink="app-eee" mat-button>eee</a> <a routerLink="app-fff" mat-button>fff</a> <a routerLink="app-ggg" mat-button>ggg</a> <a routerLink="app-hhh" mat-button>hhh</a> <span><a href="https://api.whatsapp.com//send?phone=1234567890"> <svg viewBox="0 0 32 32" class="whatsapp-ico"> <path d=" […]

By Hello
Published
Categorized as angular, angular-material, css, html Tagged , , ,

Hwo to place button on the botton in a TAB?

I want to put a button on the bottom of a TAB. But it is not working even I use justify-self: end; or bottom: 0 Html: <mat-tab-group> <mat-tab label="First" class="container"><div>content 1</div> <button class="btn">Submit</button> </mat-tab> <mat-tab label="Second"> Content 2 </mat-tab> <mat-tab label="Third"> Content 3 </mat-tab> </mat-tab-group> CSS: container { display: flex; flex-direction: column; } .btn { […]

By Hello
Published
Categorized as angular-material, css, html Tagged , ,

How to get BehaviourSubject value in other component if I type the component url directly?

Let’s simplify the question. Say the angular application only has a few components. In app component html, <app-nav></app-nav> <router-outlet></router-outlet> The ts file we inject a service to get navigation menu. The service contains a BehaviourSubject to handle menu items. @Injectable({ providendIn: ‘root’ }) export class AppService { public items = new BehaviourSubject<Item[]>([]); public getMenu() { […]

By Hello
Published
Categorized as angular, behaviorsubject, rxjs Tagged , ,

How to use amplify sign-in only?

In my angular application, I just want to use Amplify Sign-in function only. I don’t want to use Amplify UI Angular since I have created my own login form. I want to pass the username and password to do authentication. I followed the example, but not sure how to get it working. I think that […]

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq