Skip to content

Tag: angular

Angular – No provider for FormBuilder

I am using Angular 9. I am getting the following error: No provider for FormBuilder It has been reported in many cases, and the general solution appears to be to add the FormsModule to the app.module.ts file. e.g. I have tried this, but am still getting the error. Question Am I maybe doing something that&#821…

Catch the click event on class inside SVG in Angular

In my Angular 9 app I need to add the svg file as an interactive image. The svg itself is in my-file.svg and looks like this: I have a component: And in the car-view.component.html I include this svg as: How can I call the elementClicked() function inside CarViewComponent on click event on my-polygon-class (w…

Angular Validator check if input is number

I’m trying to perfom form validation in Angular 9 to check if the value of a certain input is a number (integer or decimal). I therefore created the following custom validator: It works fine for an integer or decimal input, telling my that it’s valid, however it also tells me that the following st…

Can’t do a default import in Angular 9

I changed tsconfig.json by adding this properties “esModuleInterop”: true, “allowSyntheticDefaultImports”: true, in order to be able to import a npm package import * as ms from “ms”; But I still get this error What am I missing? Update: If I change with import ms from &#822…

ng-select : add an extra option

How can I add an extra item to my ng-select dropdown like the Create New in the following image : This is the current code I have: I tried using <ng-option> but the item didn’t appear in the dropdown. How can I add an extra item form the template? Answer You can use [addTag] and addTagText. [addTa…

2 select filters on Array Values in object

I have the below data object: And a html page with 2 select boxes. In my ts file I would like to filter the tags array for selectedTag1, selectedTag2 or Both. i am not sure how to filter the array (do I need to loop through it?) AND I do not know how to combine the 2 filters (do I