 
   defaults:
     activeClasses: 'ui-state-active'
+    applyToRoot: false
+    modelStateField: 'state'
 
   initialize: ->
     @router = Router.getInstance()

# class MyView extends Marionette.ItemView
#   behaviors:
#     UISref: {}
#     UISrefActive: {activeClasses: 'state-is-active'}
#
exports.UISrefActive = class UISrefActive extends Mn.Behavior
  ui:

    @onStateChange()

  onStateChange: ->
    if @getOption('applyToRoot')
      # state params are not supported on the view root element
      compareState = @view.model?.get(@getOption('modelStateField'))
      if compareState?
        classFn = if @router.stateService.includes(compareState) then 'addClass' else 'removeClass'
        @$el[classFn](@options.activeClasses)

    @ui.active.each (i, el) =>
      $el = $(el)
      params = $el.attr('ui-sparams')
