-2

I create a svg and add a path to it with SVG.js as follow.

this.roomPlan = SVG('roomPlan').attr('id','roomPlanSvg').size(1024, 
768);
this.roomPlan.path(room.area.d);

I have a external .scss file and I have some style as follow;

.room-bg {
  fill: nb-theme(card-bg);
  stroke: transparent;
  cursor: pointer;
  stroke-width: 4px;
}

I want to add .room-bg selector to my path element as class like other html. for example ;

<path class="room-bg" />

Note: I'm developing Angular2-Typescript app and I add SVG.js to project as npm package.

Thanks for helps.

antzshrek
  • 9,276
  • 5
  • 26
  • 43
Fatih Svk
  • 41
  • 1
  • 3
  • 9

1 Answers1

0

You should just be able to do:

this.roomPlan.path(room.area.d).addClass("room-bg");

See: [http://svgjs.dev/manipulating/#addclass]

wout
  • 2,477
  • 2
  • 21
  • 32
Paul LeBeau
  • 97,474
  • 9
  • 154
  • 181