backbone-anchor-handler

Catch anchor clicks and try routing them via Backbone.js

Usage no npm install needed!

<script type="module">
  import backboneAnchorHandler from 'https://cdn.skypack.dev/backbone-anchor-handler';
</script>

README

Backbone Anchor Handler

Catch anchor clicks and try routing them via Backbone.js

About

wercker status

Simple library to catch clicks on anchor links and attempts to route them via Backbone.js.

Installation

npm install --save backbone-anchor-handler

Usage

var anchorHandler = require('backbone-anchor-handler'),
    Backbone = require('backbone');

anchorHandler.init(Backbone)

Thats all! Now your all set to have you links routed via Backbone!

Special routing considerations

You can specify backbone specific routing considerations by specifying data attributes with the required behavior. By default, all routing will be done with {trigger: true, replace: false}

To disable triggering: add data-bb-trigger="false"

To specify replace: add data-bb-replace

To route a link without affecting history, you can add data-bb-transparent. This option will bypass all history, and the url wont be updated, while still routing the request via Backbone's router.