Search code examples
javascriptangularangular6ngx-editor

ngx-editor link redirects to url combined with angular project url


so I am using ngx-editor with angular 6 to have Rich Text support. I want to add links in the paragraph and on link click, open url in new tab.

On html page, I am dynamically rendering data as:

<div [innerHTML]="Description"></div>

where Description is typescript string var.

My problem is, when I click on the link rendered from above html code, it opens url as:

http://localhost:4200/www.google.com

where I added www.google.com as link from ngx-editor window.

I want it to redirect to www.google.com.

So I want solution to remove project URL from link URL and open only link URL dynamically.

Thanks in advance.


Solution

  • You need to add http:// or https:// when creating your link.