Search code examples
htmlangular-ui-routerhref

alternative <base href=""> tag


Is it possible to have an alternative <base> tag to use conditionally?

I have the standard:

<base href="/" />

But for one route it would be awesome if I could use the base href as:

<base href="/path/" />

Is this possible?


Solution

  • Conditionally using Angular, yes. Using ng-href:

    <base ng-href="{{base_href}}" />
    

    And use Angular Router to populate the values for base_href. The href is a HTML Attribute, which is static, while ng-href is same as the former, but it is an Angular Directive.