I am trying to navigate to the new page on clicking on the area element but nothing happens. If I same apply to <a></a>
tag it works like as intended.
HTML
<area shape="rect" coords="0,0,82,126"
routerLink="/help"
target="_blank" alt="Circle" />
app.module.ts
@NgModule({
imports: [BrowserModule, FormsModule,
RouterModule.forRoot([
{
path: '',
component: HelloComponent
},
{
path: 'help',
component: HelpComponent
}
])],
declarations: [AppComponent, HelloComponent, HelpComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
I am using Angular 7.0.1.
Can you check the below stackblitz, maybe you missed adding the surrounding components for area
element.
Below is the html wrapping the area
element.
<img usemap="#infographic" src="https://interactive-examples.mdn.mozilla.net/media/examples/mdn-info2.png" alt="MDN infographic" />
<map name="infographic">
<area shape="poly" coords="130,147,200,107,254,219,130,228"
routerLink="/help" alt="HTML" />
<area shape="poly" coords="130,147,130,228,6,219,59,107"
routerLink="/docs/Web/CSS"
target="_blank" alt="CSS" />
<area shape="poly" coords="130,147,200,107,130,4,59,107"
routerLink="/docs/Web/JavaScript"
target="_blank" alt="JavaScript" />
</map>
<router-outlet></router-outlet>
The router-outlet was missing in the updated stack blitz from the user, on click of the middle area element navigation happens!