how to delete particular json object from array of array

Issue I have array within the array and i want to delete particular JSON object by its value. rows=[ [isTrue:’false’,isAvailable:’false’,name:’Abc’,data:’ABC’,Value:’ABC’] [isTrue:’false’,isAvailable:’false’,name:’Abc1′,data:’ABC1′,Value:’ABC1′] [isTrue:’false’,isAvailable:’true’,name:’Abc2′,data:’ABC2′,Value:’ABC2′] [isTrue:’false’,isAvailable:’true’,name:’Abc3′,data:’ABC3′,Value:’ABC3′] ] I want rows=[ [name:’Abc’,data:’ABC’,Value:’ABC’] [name:’Abc1′,data:’ABC1′,Value:’ABC1′] [name:’Abc2′,data:’ABC2′,Value:’ABC2′] [name:’Abc3′,data:’ABC3′,Value:’ABC3′] ] I want to remove all the data which

Continue reading

BrowserModule has already been loaded

Issue This is my code: import { CommonModule } from ‘@angular/common’; import { HttpClientModule } from ‘@angular/common/http’; import { NgModule } from ‘@angular/core’; import { BrowserAnimationsModule } from ‘@angular/platform-browser/animations’; import { LanguageTranslationModule } from ‘./shared/modules/language-translation/language-translation.module’ import { AppRoutingModule } from

Continue reading

How to generate form Input field as per selected number from dropdown (select)

Issue I want to generate input text boxes as per selected value from dropdown. <mat-label>Options</mat-label> <mat-form-field> <select matNativeControl name=”Options” required> <option value=”2″>2</option> <option value=”3″>3</option> <option value=”4″>4</option> <option value=”5″>5</option> </select> </mat-form-field> just after this select box some input fields should be

Continue reading

How to generate JSON of a HTML form on submit in Angular 7

Issue I want to generate JSON from a HTML form to store that form template in ms sql database. Please help. <div class=”container”> <mat-card> <mat-toolbar color=”accent”> <div align=”center” style=”color:white;text-align: right;”> Create Survey/Template </div> </mat-toolbar> <br><br> <mat-card-content> <form [formGroup]=”employeeForm”(ngSubmit)=”onFormSubmit(employeeForm.value)”> <table> <tr>

Continue reading

How to add form elements on button click in Angular 7

Issue I want to repeat below form elements <tr> <td class=”tbl1″> <mat-form-field class=”demo-full-width”> <input name=”Label” matTooltip=”Label” matInput placeholder=”Label” ngModel> </mat-form-field> <mat-form-field> <mat-label>Input Type</mat-label> <select name=”inputBoxType” matNativeControl ngModel required> <option value=”text”>Text</option> <option value=”number”>Number</option> <option value=”email”>Email</option> </select> </mat-form-field> <button type=”button” mat-raised-button color=”accent”

Continue reading

Getting value of checkbox using angular

Issue I have a problem with getting values of checkbox in angular. Here is the snippet: <div class=”list-group-item” *ngFor=”let ticket of tickets”> <input type=”checkbox” [name]=”ticket.id” [id]=”ticket.id” [value]=”ticket.id” formControlName=”ticketTypes” /> <label for=”{{ ticket.id }}”>{{ ticket.name }}</label> </div> I am getting above

Continue reading

Angular 7 and CDNs

Issue I am writing my first Angular app using Angular 7. Usually, when writing HTML I make use of CDNs for Bootstrap, fonts etc. Looking at some tutorials they recommend leaving the default ‘index.html’ as generated but that seems to

Continue reading

How to set placeholder for mat-radio-button or mat-radio-group?

Issue I have a DOM element: <mat-radio-group [formControlName]=”field.name” [disabled]=”field?.disabled”> <div> <mat-label>{{ placeholder }}</mat-label> </div> <mat-radio-button *ngFor=”let option of field.options” [value]=”option.value”> {{ option.label }} </mat-radio-button> </mat-radio-group> How to set native placeholder for mat-radio-button or mat-radio-group ? Solution This might help: <fieldset>

Continue reading

Angular clear editable fields of table problem

Issue I have problem. When i want to add new row to table. It clears all previous rows. This way i push new empty element. testFunc() { //console.log(this.ProcessVATElems[this.elemIter].Lp); this.ProcessVATElems[this.elemIter].Lp = ++this.elemIter; var elem = new ProcessVatElement() elem.Lp = 0; this.ProcessVATElems.push(elem);

Continue reading

How to set form control value in nested form

Issue this.workScheduleTableForm =this.fb.group({ rowId:[”], personId:[”], permanentWorkSchedule:[”], workScheduleDayDetails:this.fb.group({ days:[”], sun:this.fb.group({ hr:[”], code:[”], start:[”], end:[”], lunch:[”], }), }), }) I am able to set second level like this.workScheduleTableForm.controls.workScheduleDayDetails[‘controls’][‘days’].setValue(‘test’) problem with third level this.workScheduleTableForm.controls.workScheduleDayDetails.control.days.[‘control’][‘hr’].setValue(‘test’); I try this one but its not working. Solution

Continue reading

I need to split an array into N number of arrays based on searching for an element from another array

Issue I need to split an array into N number of arrays based on searching for an element from another array. consider this scenerio var test = [“1″,”2″,”3″,”env”,”6″,”7″,”8″,”uat”,”2344″,”wersdf”,”sdfs”]; var test2=[“env”,”uat”]; now I want a map like { env:[“6″,”7″,”8”], uat:[“2344″,”wersdf”,”sdfs”] }

Continue reading

How to set dropdown value in angular 7

Issue I am trying to set dropdown value by programmatically using formcontrolname but not working.I have given my code below.How to set dropdown value that?Anyone can have idea?please help to find the solution. app.component.html: <p-dropdown [values]=”dropdownData” fornControlName=”datavalue”><p-dropdown> app.component.ts: dropdownData=[ {name:’UK’,value:’UK’},

Continue reading

Cannot read property 'createComponent'?

Issue Full code is: export class FileSaveDialogComponent implements OnInit, AfterViewInit, OnDestroy { @ViewChild(“target”, { read: ViewContainerRef, static: true }) target; ngAfterViewInit() { console.log(this.target); const component = this.createComponent(); const factory = this.resolver.resolveComponentFactory(component); this.componentRef = this.target.createComponent(factory); } } HTML is: <div class=”savefile-content”

Continue reading

Custom leaflet geocoder marker

Issue I wanna change the default Marker of leaflet geocoder, for that I overrided the markGeocode function and added it to the Control geocoder like that (using typeScript): const geocoder = L.Control.geocoder({ position: ‘topright’, placeholder: ‘Rechercher…’, showResultIcons: true, errorMessage: ‘Aucun

Continue reading

Deleting an object in Angular NGXS

Issue I have a problem deleting a comment on my post. How would you do it? I’m using the Angular NGXS state management. Pls see this link CLICK THIS LINK onDeleteComment(commentId: number){ this.store.dispatch(new DeleteComment(commentId)); } @Action(DeleteComment) deleteComment( ctx: StateContext<PostStateModel>, {

Continue reading

Error There is no directive with "exportAs" set to "matTableExporter" when using MatTableExporter

Issue From the docs example I’m trying to use the mat table exporter, this way: <ng-container> <mat-card class=”mat-card py-0″> <mat-card-header class=”label”> <ng-container> <mat-card-title>{{titoloTabella}}</mat-card-title> <button mat-button class=”align-right” (click)=”changeClass()”> <mat-icon [ngClass]=”(rotate)?’rotate’:’no-rotate'”>keyboard_arrow_down</mat-icon> </button> </ng-container> </mat-card-header> <table mat-table matSort [dataSource]=”dataSource” matTableExporter #exporter=”matTableExporter”> <ng-container *ngFor=”let

Continue reading

How to assign the values to variable in angular 7

Issue I am trying to assign the values to variable but not working.If anyone know please help to find the solution. My code: app.component.ts: public power:any; public ice:any; public cake:any; changeValue(prop,val){ this.[prop]=val; console.log(this.[prop]); } this.changeValue(“power”,”124525″); this.changeValue(“ice”,”125658″); this.changeValue(“cake”,”122568″); Solution public power:any;

Continue reading