I need to save a relative URL to a SharePoint subsite in the html controller of an Angular app I'm deploying directly to a page. I need the URL to be dynamic, so that when I save this site as a template, the URL will point to whatever the current site is.

In my HTML controller, I tried using

<a href="~site/List/ListName/AllItems.aspx">

This seems to work partially? It will print the current site, but then instead of it looking like "https://contoso.sharepoint.com/HR/List/ListName/AllItems.aspx" it prints it as "https://contoso.sharepoint.com/HR/~site/List/ListName/AllItems.aspx"

Am I doing something wrong or will I need to get the current site programmatically via REST?

1 Answer 1


Never mind... just decided to use an HTML relative URL. Using:


worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.