Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

AngularJS - Generating dynamic image map #8719

Closed
@nmusmani

Description

@nmusmani

I am getting image map from the server and trying to display contents using ng-bind-html. while rendering AngularJS removes name attribute from map tag. Therefore user clicks are not affective in map.

Sample: http://plnkr.co/edit/j5ylalmEabQH7GonOB4C?p=preview

angular.module('imgMapExample', ['ngSanitize'])
.controller('ExController', ['$scope', function($scope) {

  var imgPath = "http://www.w3schools.com/tags/";
  var imgPlanet =  imgPath + "planets.gif";
  var imgSun =  imgPath + "sun.htm";
  var imgvenus =  imgPath + "venus.htm";
  var imgmercur =  imgPath + "mercur.htm";

  var ImgTag = '<img src="' + imgPlanet + '" width="145" height="126" alt="Planets" usemap="#planetmap" />';
  var imgMap = '<map name="planetmap"> <area shape="rect" coords="0,0,82,126" alt="Sun" href="' + imgSun + '"> <area shape="circle" coords="90,58,3" alt="Mercury" href="' + imgmercur + '"> <area shape="circle" coords="124,58,8" alt="Venus" href="' + imgvenus  + '"> </map>';

  var imgMapTest = '<map name="planetmap"></map>';

  $scope.ImgData =  ImgTag + imgMap;

}]);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions