Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hashbang-href-loader

AngularJS hashbang href rewriter loader module for Webpack

This is useful in situations where AngularJS HTML5 mode does not work (e.g. Cordova), but where you want to use HTML5 mode style URLs. For example, this may happen when the same html template is to be used on a html5-mode enabled desktop browser as with Cordova).

Usage

Documentation: Using loaders

var htmlContent = require("raw!hashbang-href!./file.html");
// => returns file.html content as string, with #! added to all root-relative href="" attributes

Example

The following source HTML content:

<a href="/page">Go to page</a>
<a href="relativeLink">Go to relative page</a>

becomes:

<a href="#!/page">Go to page</a>
<a href="relativeLink">Go to relative page</a>

Note

To use href links in this form, configure your AngularJS application with:

$locationProvider.html5Mode(false).hashPrefix('!')

More information: AngularJS HTML5 mode

License

MIT (http://www.opensource.org/licenses/mit-license.php)

About

AngularJS hashbang href rewriter loader module for Webpack

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages