Encountering an Angular 8 error: Unable to bind to 'config' as it is not a recognized property of 'maphilight'

I'm working with Angular 8 and I need to implement maphilight to select specific predefined areas on an image map (e.g. nose, eye, etc.)

https://i.sstatic.net/Bevyg.png

To integrate maphilight into my project, I used the following command: npm i ng-maphilight --save In my app.module.ts file, I imported MaphilightModule in the imports array. Within my component's HTML file, I added the maphilight map as a container element.

 <div class="body-img">
    <maphilight
            id="statesMap"
            [hidden]="hidden"
            [config]="config"
          >
            <img src="../../assets/image1.png" class="map" alt="bodyChart" usemap="#bodyChart" >

            <span *ngFor="let c of bodyAreas; let pickIndex=index; let count=index">
                <span *ngIf="c.picked" (click)="pick(pickIndex)" class="pick-span"
                    [ngStyle]="c.style">{{ c.title }} </span>
            </span>
        <map name="bodyChart" >
            <area *ngFor="let c of bodyAreas; let areaIndex=index" [title]="c.title" [alt]="c.alt" [shape]="c.shape" [coords]="c.coords" (click)="pick(areaIndex)" />
        </map>
    </maphilight>
  </div>

In my component's TypeScript file, I referenced the maphilightComponent like this:

@ViewChild(MaphilightComponent, {static: false}) maphilightComponent: MaphilightComponent;
hidden = false
public config = {
    // configuration settings here
}

ngAfterViewInit() {
    // code for initialization
}

The error message I encountered is:

Uncaught Error: Template parse errors: Can't bind to 'config' since it isn't a known property of 'maphilight'. at JitCompiler._compileComponents (:4200/vendor.js:108430) at :4200/vendor.js:108343 at Object.then (:4200/vendor.js:84703) at JitCompiler._compileModuleAndComponents (:4200/vendor.js:108342)

Any advice on how to resolve this issue would be greatly appreciated.

Answer №1

My recommendation would be to utilize ng-maphilight rather than solely relying on maphilight. To install, simply execute the command below:

npm i ng-maphilight --save

For more information, please refer to the documentation

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Intercepting HTTP requests in Angular, but not making any changes to the

Working on Angular 13, I am trying to attach a JWT token to the headers in order to access a restricted route on the backend. However, after inspecting the backend, it seems that the JwtInterceptor is not modifying the HTTP request headers. I have included ...

A guide to setting initial values in Angular 2 using TypeScript

My Rank class includes attributes for "loses" and "wins" obtained from a web service. I need to calculate the "points" attribute based on these values. For example: for(int i = 0; i<loses; i++{ points += 1; } for(int i = 0; i<wins; i++{ point ...

Leveraging *ngFor to extract HTML content from ion-label

I've encountered an issue while using *ngFor in my HTML like this: <ion-slides #slides [options]="slideOpts"> <ion-slide class="numbers-wrapper" *ngFor="let questionNumber of numbers" (click)="clickQue ...

Allow only specified tags in the react-html-parser white list

Recently, I've been working on adding a comments feature to my projects and have come across an interesting challenge with mentioning users. When creating a link to the user's profile and parsing it using React HTML parser, I realized that there ...

An array comprising multiple arrays containing strings

I need help creating a nested array of strings like the one shown below: let rules : type = [ ["N"] ["N", "N"] ["N", "N", "N"] ] I'm struggling to set the correct type for this array. Can you assist me with this? ...

The interconnected world of Angular: Leveraging reactivity and smooth communication through services

Typically, when searching for examples of cross-component communication via services, you will find that RxJS is commonly used within the service. However, it seems like this might not always be necessary. For instance, in the scenario described below, bot ...

Utilizing Implicit Waits for End-to-End Testing on Angular Applications

I am currently facing intermittent timeout and waiting issues in my E2E tests for an Angular 4/ASP.NET Core Web API application, which are implemented using Selenium WebDriver. In the existing E2E framework, there is a method called WaitForAngular() that ...

Error code ts2322 indicates that the specified type is not compatible with the expected type. This can occur when an object literal tries

Does the type have the member explicitly declared? Looking for some ideas! https://i.sstatic.net/mMgq8.png https://i.sstatic.net/lndC5.png https://i.sstatic.net/9vJA7.png ...

How can I resolve the issue of a React hook being called within a callback function when working with TypeScript and React?

I am trying to display the names of company and owner when sharing an item, but I am encountering an error that says "React hook cannot be used in callback function. React hooks must be called in a react functional component or a custom react hook function ...

Step-by-step guide to debugging a Typescript node.js application from a remote location

With this particular configuration, I have successfully been able to remotely debug js files (on my Raspberry Pi). However, my goal is to be able to break inside ts files just like I can do during local debugging. Is this achievable? I have attempted vari ...

What is the best way to update the image source in Angular 2?

Learn How to Get a Directive's Reference in Angular 2 Looking to swap image src on hover? Check out this helpful link for guidance:-- ...

The error middleware for Node does not effectively manage exceptions

Our backend system relies on node and TypeScript, utilizing the overnightJS library. Despite my attempts to create an Error middleware using either of the following approaches: this.app.use((error:Error, req: Request, res: Response, next: NextFunction) =&g ...

The name 'Queue' cannot be located in Typescript, error code ts(2304)

I'm currently trying to create a private variable of type InnerItem, but I keep encountering the following error: Error: Cannot find name 'Queue'.ts(2304) private savedItems: Queue<InnerItem> = new Queue<InnerItem>(20); Could ...

What category does a Fresh of Deno event fall under?

I'm currently working with Deno and fresh. When it comes to events in islands, what is the type for an event like the one below? export function Sample() { return ( <input type="file" onChange={(e) => ...} // What typ ...

Definition duplication is necessary for TypeScript object properties

I'm currently facing a challenge with TypeScript as I attempt to develop a function that properly assigns default values for an optional object within another object. Even though I am setting up everything in the parameters, I keep encountering an er ...

What is the best way to troubleshoot a peer dependency error in my Angular 10 project while utilizing npm?

I am currently in the process of upgrading my Angular 10 project, which is running on Node 14.x and npm 6.14.x. When I run the following command: npm ls I encounter a series of issues related to peer dependencies in npm. The errors are as follows: "p ...

Confused about how to correctly utilize template variables within an *ngIf condition

My goal is to create a feature where users can adjust the number of rows in the catalog view on spiritwoodart.com. However, I encountered an issue at the initial stage of implementation and believe it stems from a basic misunderstanding. I am struggling to ...

What's causing the discrepancy in the parameters?

I have an issue with the following method: import { getCookie } from 'cookies-next'; export const getAccessTokenFromCookies = ( req?: NonNullable<Parameters<typeof getCookie>[1]>['req'], res?: NonNullable<Parameters& ...

Bring the worth of node to angular universal

We are facing a challenge in our Angular Universal app where we need to transfer a value from node.js to Angular when running server-side. Our current solution involves the following code snippet in server.ts: const theValue: TheType = nodeLogicToRetrieve ...

"An error has occurred stating that the header is not defined in

It is a coding issue related to payment methods. The headers type is undefined in this scenario, and as a newcomer to typescript, pinpointing the exact error has been challenging. An error message is indicating an issue with the headers in the if conditio ...