message: The POST method is not supported for this route. Supported methods: GET, HEAD, PUT, PATCH, DELETE

Issue So I have an API route Route::group([‘prefix’ => ‘users’], function() { Route::group([‘prefix’ => ‘seminar’], function() { Route::get(‘/{employee_number}’, [UserProfileController::class, ‘getSeminar’]); Route::post(‘/{user}’, [UserProfileController::class, ‘createSeminar’]); Route::put(‘/{seminar}’, [UserProfileController::class, ‘updateSeminar’]); Route::delete (‘/{seminar}’, [UserProfileController::class, ‘deleteSeminar’]); }); }); And a controller public function createSeminar(User $user, Request

Continue reading

Cannot read properties of undefined reading base64 – Angular

Issue I have input field to upload image <div class="form-group"> <label for="exampleFormControlInput1"> Upload Image </label> <input #imageInput type="file" accept=’image/*’ class="form-control" (change)="onChange($event)" /> </div> <div class="pb-4 form-group float-right"> <button class="btn btn-primary btn-main" (click)="saveImage()"> Save </button> &nbsp; <button class="btn btn-primary btn-cancel"> Cancel

Continue reading

Dropdown (select option) not getting data – Angular 11

Issue Here is my model.ts export interface IUserEducationalBackground { id: number; user_id: number; studies_type: string; year: number; course: string; } I have a dropdown like this. <div class="col-5"> <ng-select bindLabel="name" bindValue="name" [items]="studiesType" [(ngModel)]="studiesType.name" (Change)="searchStudies(studiesType.name)"> </ng-select> </div> whenever this value is

Continue reading

Angular11 update, ng2-charts, Error: Can't import the named export 'Chart' from non EcmaScript module (only default export is available)

Issue I am currently working on updating the angular version of a project. It was v10 and I updated to v11. Fixed many errors, but ng2-charts keep throwing these errors on ng serve. Error: node_modules/ng2-charts/lib/base-chart.directive.d.ts:39:21 – error TS2694: Namespace ‘”E:/projects/Credo/kratos/node_modules/@angular/core/core”‘

Continue reading

Angular11 update, ng2-charts, Error: Can't import the named export 'Chart' from non EcmaScript module (only default export is available)

Issue I am currently working on updating the angular version of a project. It was v10 and I updated to v11. Fixed many errors, but ng2-charts keep throwing these errors on ng serve. Error: node_modules/ng2-charts/lib/base-chart.directive.d.ts:39:21 – error TS2694: Namespace ‘”E:/projects/Credo/kratos/node_modules/@angular/core/core”‘

Continue reading

how to download PDF from byteArray in angular 11?

Issue I have byte array and I want to download pdf without any library, for example file-saver. service.ts return this.http.get(`${this.invoiceUrl}/GenerateInvoice`, { responseType: "arraybuffer", observe: "response", params } ); component.ts file(byte) { var byteArray = new Uint8Array(byte); var a = window.document.createElement(‘a’);

Continue reading

Cors Issue in Angulaar 11 with HttpClient

Issue this is my service file code. getSearchValue() { let headers = new HttpHeaders({ ‘Accept’: ‘application/json’, ‘Access-Control-Allow-Origin’: ‘*’, ‘Access-Control-Allow-Headers’: ‘Content-Type’, ‘Access-Control-Allow-Methods’: ‘GET,POST,OPTIONS,DELETE,PUT’, ‘Authorization’: ‘Bearer Key[enter image description here][1]’, }); let options = { headers: headers }; return this.http.get(this.baseUrl, options) }

Continue reading

Cors Issue in Angulaar 11 with HttpClient

Issue this is my service file code. getSearchValue() { let headers = new HttpHeaders({ ‘Accept’: ‘application/json’, ‘Access-Control-Allow-Origin’: ‘*’, ‘Access-Control-Allow-Headers’: ‘Content-Type’, ‘Access-Control-Allow-Methods’: ‘GET,POST,OPTIONS,DELETE,PUT’, ‘Authorization’: ‘Bearer Key[enter image description here][1]’, }); let options = { headers: headers }; return this.http.get(this.baseUrl, options) }

Continue reading

How can I switch the openAll() or closeAll() (button) from Angular Material expansion panel?

Issue I want to switch between 2 buttons: OpenAll and CloseAll. Can I read a boolean of mat-accordion if it’s all opened or closed? <div class="row"> <mat-icon *ngIf="accordion.open()" (click)="accordion.openAll()">open_in_full</mat-icon> <mat-icon *ngIf="!accordion" (click)="accordion.closeAll()">close_fullscreen</mat-icon> </div> <div class="message-box row" *ngIf="notes.length; else noResult"> <mat-accordion

Continue reading

How to use multiple formgroup inside the form array

Issue <div formArrayName="partners" style="margin-top:15px;" *ngIf="partner"> <div *ngFor="let partner of partners().controls; let i = index" [formGroupName]="i"> <div class="partner-background"> <div class="row"> <div class="col col-12"> <h6 style="padding:5px;">Manage Partner <button id="remove" class="btn" style="float:right;" *ngIf="partners().length > 1 && i>0" (click)="removePartner(i)"><i class="fas fa-minus-circle"></i></button></h6> </div> <div class="col

Continue reading

Angular 11: Why can't the compiler find 'GeolocationPosition' during compiling? "Cannot find name 'GeolocationPosition'"

Issue Why does the angular compiler can’t find GeolocationPosition and GeolocationPositionError? VSC doesn’t give an error and only during compiling it gives me an error. Error: src/app/modules/shared/services/position.service.ts:10:46 – error TS2304: Cannot find name ‘GeolocationPosition’. 10 private positionSource = new ReplaySubject<GeolocationPosition>(1);

Continue reading

Merge two observables to get the value of two different Dto

Issue I have two observables, each one you get the value of a Dto: this.about.aboutHeInfo().subscribe((heInfo: HemDto) => { this.uiUtils.openDialogResizable({ hem: heInfo }, true, AboutComponent).subscribe(); }); this.about.aboutPeInfo().subscribe((peInfo: PeoDto) => { this.uiUtils.openDialogResizable({ peo: peInfo }, true, AboutComponent).subscribe(); }); The problem is that

Continue reading

Angular 11 CORS issue proxy port being incremented

Issue I’m witnessing something that I really don’t like and that I think is the root of my issue : Access to XMLHttpRequest at ‘https://localhost:5001/calls/api/Auth/register’ (redirected from ‘http://localhost:4200/calls/api/Auth/register’) from origin ‘http://localhost:4200’ has been blocked by CORS policy: Response to preflight

Continue reading

Return false instead of undefined

Issue On an Angular 11 / Typescript application I have: authorize(policy: Policy) : Observable<boolean> { switch(policy) { case Policy.Admin: return zip(this.authenticationService.isSignedIn(), this.user$).pipe( map(([isSignedIn, user]: [boolean, UserModel]) => isSignedIn && user?.claims?.some((claim: Claim) => claim.value === ‘Admin’)) ); user is of type

Continue reading