       items:  "=macMenuItems"
       style:  "=macMenuStyle"
       select: "&macMenuSelect"
+      pIndex: "=macMenuIndex"
 
     link: ($scope, element, attrs, ctrls) ->
       $scope.selectItem = (index) ->

        - `index` - {Integer} Item index
@param {Object} mac-menu-style Styles apply to the menu
@param {Expression} mac-menu-index Index of selected item
        - `index` - {Integer} Item index
###

angular.module("Mac").directive "macMenu", [

      $scope.setIndex = (index) ->
        $scope.index = index

        if attrs.macMenuIndex?
          $scope.pIndex = parseInt(index)

      # sync local index with user index
      if attrs.macMenuIndex?
        $scope.$watch "pIndex", (value) ->
          $scope.index = parseInt(value)
]
