module.exports = FormButtonsDirective;

function FormButtonsDirective () {
    return {
        restrict: 'AE',
        replace: true,
        scope: {
            submitClick: '&submitClick',
            cancelClick: '&cancelClick'
        },
        templateUrl: '/src/utils/views/formButtons.tmpl.html',
        link: function (scope, elem) {
            angular.element(elem[0].getElementsByClassName('form-button-submit')).on('click', function () {
                scope.submitClick();
            });
            angular.element(elem[0].getElementsByClassName('form-button-cancel')).on('click', function () {
                scope.cancelClick();
            });
        }
    };
}
