 
   onClickLink: ->
     # maybe parse and navigate to state if this element was inserted after
-    # original attachment (through data binding or whatever)
+    # original dom insertion (through data binding or whatever)
 
   onAttach: ->
     # Go through all the ui-sref links and turn their ui-sref and HTML-escaped

    activeClasses: 'ui-state-active'

  initialize: ->
    router = UIRouterMarionette.getInstance()
    @deregister = router.transitionService.onSuccess {}, => console.warn("state changed!!!")

  onRender: ->
    @deregister()
    router = UIRouterMarionette.getInstance()
    @ui.active.each (i, el) ->
      $el = $(el)
      state = $el.attr('ui-sref-active')

  onStateChange: ->


  onBeforeDestroy: ->
    @deregister()

{ UIRouterMarionette } = require('../index')


# A helper behavior for linking to states with or without state parameters.
# Element attributes:
#   ui-sref="app.state.substate"
#   ui-sparams='{"client_id": 5}' - optional if state doesn't need params or
#                                   you're linking to a sibling/child state
#                                   with the same parameters.
#                                   The value should be HTML-encoded JSON.
#                                   A template helper method is helpful here.
# Behavior options: none
#
exports.UISref = class UISref extends Mn.Behavior
  ui:
    sref: '[ui-sref]'
