Conditional reset method "if disable ignore not disable reset" angular

Issue <div> <div> <label>Name</label> <input type="text" [(ngModel)]="name" [disabled]="editData" </div> <div> <label>address</label> <input type="text" [(ngModel)]="address" </div> </div> <button (click)=add() >add</button> <button (click)=edit()>edit</button> <button (click)=reset()>reset</button> Note:- On add() both fields should be reset but on edit only address field should be reset

Continue reading

Uncaught ReferenceError: __importDefault is not defined; After going to Angular 9

Issue After running ng serve In the browser, developer tools, I see the following error: Uncaught ReferenceError: __importDefault is not defined at Module../src/app/home/home.component.ts (home.component.ts:5) at __webpack_require__ (bootstrap:79) at Module../src/app/app-routing.module.ts (main.js:98) at __webpack_require__ (bootstrap:79) at Module../src/app/app.module.ts (app.component.ts:8) at __webpack_require__ (bootstrap:79) at

Continue reading

Test engine failure when FormGroup is used in Angular 9

Issue I have the following component: export class BaseFormComponent implements OnInit { basicFormGroup: FormGroup; constructor( protected basicProviderService: BasicProviderService, protected formBuilder: FormBuilder, protected dialog: MatDialog, protected spinner: NgxSpinnerService ) { this.basicFormGroup = this.formBuilder.group({ name:[”], note: [”, Validators.required], description: [”, Validators.required] });

Continue reading

Render dynamic form based on dropdown

Issue i am trying to create dynamic form based on dropdown but i get the following error when i try it: field-builder.component.ts.FieldBuilderComponent.html:23 ERROR TypeError: Cannot read property ‘valid’ of undefined at FieldBuilderComponent.get isValid [as isValid] (field-builder.component.ts:45) at Object.updateDirectives (field-builder.component.ts.FieldBuilderComponent.html:26) at

Continue reading

Facing issue at Instascan Library in Angular 6

Issue I have imported instascan library in Index.html file , <script type=”text/javascript” src=”https://rawgit.com/schmich/instascan-builds/master/instascan.min.js”> </script> I have code in my app.component.html as below, <video id=”preview”></video> I have code in my app.component.ts as below, let scanner = new Instascan.Scanner({ video: document.getElementById(‘preview’), mirror:

Continue reading

How can I solve Angular module import problem?

Issue It’s working import { MatButtonModule } from ‘@angular/material/button’ import { MatMenuModule } from ‘@angular/material/menu’ Not Working import { MatButtonModule,MatMenuModule } from ‘@angular/material’ Why do you think it would be? Solution That’s no longer supported in Angular’s 9th version. Components

Continue reading

angular drop event is inconsistent

Issue Minimal reproduction: https://stackblitz.com/edit/buggydrop I’m making a simple website when user drag an element and drop it on another element so that the content of each element swap with each other. However, the problem is in (drop)=”BuggyonDrop($event)” the $event is

Continue reading

Angular 9 – Routes

Issue I’m very new at Angular 9. These are my routes: http://localhost:4200/pc_configuration –> then go to login http://localhost:4200/PC2/login — it works fine, but when I login, dashboard overwrite the id (PC2) http://localhost:4200/dashboard/ — it should be http://localhost:4200/PC2/dashboard/ These are my

Continue reading

R3InjectorError No provider for NgbDropdown

Issue I have a shared module A where I import and export NgbDropdownModule import { … NgbDatepickerModule, NgbDropdownModule, NgbModalModule …} from ‘@ng-bootstrap/ng-bootstrap’; imports: […NgbDropdownModule…] exports: […NgbDropdownModule…] In module B I just import module A and up to Angular 9 everything

Continue reading

Refresh mat-table in angular 9

Issue When I delete element my MAT-TABLE is not refresh .ts file import { MatTableDataSource, MatTable } from ‘@angular/material/table’; @ViewChild(MatTable) table: MatTable<any>; const index = this.dataSource.data.findIndex(d => Number(d.id) == Number(id)); this.dataSource.data.splice(index, 1); this.table.renderRows(); .html file <table mat-table [dataSource]=”dataSource” class=”lessons-table mat-elevation-z8″

Continue reading

Angular resolver

Issue I’m creating a resolver for my routes following the documentation on that subject. export class PlaceDetailResolverService implements Resolve<Place> { constructor(private api: ApiService, private router: Router) {} resolve(route: ActivatedRouteSnapshot): Observable<Place> | Observable<never> { let id = route.paramMap.get(“id”); return this.api.getPlace(id); }

Continue reading

How do I get my observable to have it's values for use in an NGRX effect

Issue To be honest I am a total noob at NGRX and only limited experience in rxjs. But essentially I have code similar to this: @Effect() applyFilters = this.actions$.pipe( ofType<ApplyFilters>(MarketplaceActions.ApplyFilters), withLatestFrom(this.marketplaceStore.select(appliedFilters), this.marketplaceStore.select(catalogCourses)), withLatestFrom(([action, filters, courses]) => { return [courses, this.combineFilters([

Continue reading

Angular interceptor, handle HTTP Error and retry

Issue I have a basic JWT system, and an Interceptor that checks whether the request fails due to being unauthorized. import {Injectable} from ‘@angular/core’; import {HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from ‘@angular/common/http’; import {Observable, throwError} from ‘rxjs’; import {AuthService} from

Continue reading

Angular 9 update object in array of objects

Issue As the title says I need to update one value in array. <div *ngFor=”let item of data; let i = index” > <div class=”full-w” fxLayout=’row’ fxLayoutAlign=’start center’ fxLayoutGap=’12px’> <span class=”title”>Color: </span> <span>{{item.color}}</span> </div> <mat-divider class=”full-w”> </mat-divider> <div *ngFor=”let e

Continue reading

how to input two route parameters one of which is in between the URL for navigation while using children routes in Angular CLI 8+ using Angular Router

Issue I am trying to navigate to a page providing two route parameters as follows: author/journals/:journal_Id/draftArticles/:articleId I know that two parameters can be given when route parameter is at the end of the route like author/journals/draftArticles/:journal_Id/:articleId, journal_Id, articleId and this

Continue reading

Angular. Custom tag selector in ng-template

Issue I refactor a string. So that why I need a component for it with ComponentFactoryResolver: @Component({ selector: ‘[text-in-message]’, template: `<ng-template chunk></ng-template>`, }) export class TextInMessageComponent implements OnInit { @Input() message: string; @ViewChild(ChunkInMessageDirective, { static: true }) chunkOfMessage: ChunkInMessageDirective; constructor(private

Continue reading