2
votes

In my HTML i am using like:

<object #homes style="height:500px;width:1000px" data="{{homesPath}}"></object>

In TS:

constructor(
private homesProfileService: HomesProfileService,
private sanitizer: DomSanitizer) {}

this.homesPath = this.sanitizer.bypassSecurityTrustResourceUrl(
  environment.homesPath
);

But it is giving Error:

Error: unsafe value used in a resource URL context (see http://g.co/ng/security#xss)

Is there anything wrong that i am doing.

1

1 Answers

1
votes

Got it working now by changing a bit in HTML from:

<object #homes style="height:500px;width:1000px" data="{{homesPath}}"></object>

TO:

<object #homes style="height:500px;width:1000px" [data]="homesPath"></object>

But still did not get the reason why the prior one was not working. Can anyone comment on it.