"use strict";

angular.module('monsart').controller('MaMenuCtrl',['$scope', function($scope){
        
        $scope.addMenuItem = function(){
            if($scope.itemUrl && $scope.itemText){
                $scope.menuItems.push({
                    link : $scope.itemUrl,
                    text : $scope.itemText,
                });
                $scope.itemUrl = '';
                $scope.itemText = '';
            }
        }
        $scope.removeItem = function(removedItem){
            var removedKey = -1;
            angular.forEach($scope.selectedItems, function(item, key){
                if(item.text === removedItem.text && item.link === removedItem.link){
                    removedKey = key;
                }
            });
            if(removedKey > 0){
                $scope.selectedItems.splice(removedKey, 1);
                $scope.menuItems.splice(removedKey, 1);
            }
           
        };
        $scope.refreshSelect = function(){
            console.log('here');
        }
}]);


