Используется вот этот скрипт походу,но если удалить все поля name даже ничего не помогает
; (function (ng) {
'use strict';
ng.module('popupwithcallback', []);
})(window.angular);
; (function (ng) {
'use strict';
var PopupWithCallbackCtrl = function ($sce, popupwithcallbackService) {
var ctrl = this, isRender = false;
ctrl.currentForm = "main";
ctrl.send = function () {
//console.log(ctrl);
popupwithcallbackService.send(ctrl.name, ctrl.phone, ctrl.comment).then(function (result) {
//console.log(ctrl.name, ctrl.phone, ctrl.comment);
if (result == true) {
ctrl.currentForm = "final";
popupwithcallbackService.setVisibleFooter(false);
$(document).trigger("module_popupwithcallback");
popupwithcallbackService.dialogClose();
}
});
}
ctrl.dialogOpen = function () {
//console.log(ctrl);
if (ctrl.currentForm == "final") {
ctrl.currentForm = "main";
ctrl.name = "";
ctrl.phone = "";
ctrl.comment = "";
popupwithcallbackService.setVisibleFooter(true);
}
if (isRender) {
//popupwithcallbackService.dialogOpen();
} else {
popupwithcallbackService.getParams().then(function (result) {
ctrl.modalText = $sce.trustAsHtml(result.ModalText);
ctrl.showCommentField = result.ShowCommentField;
//popupwithcallbackService.dialogRender(result.Title, ctrl);
});
}
isRender = true;
}
};
ng.module('popupwithcallback')
.controller('PopupWithCallbackCtrl', PopupWithCallbackCtrl);
PopupWithCallbackCtrl.$inject = ['$sce', 'popupwithcallbackService'];
})(window.angular);
; (function (ng) {
'use strict';
ng.module('popupwithcallback')
.directive('popupwithcallbackStart', ['$compile', function ($compile) {
return {
restrict: 'A',
link: function (scope, element, attrs, ctrl) {
var popupwithcallbacks = document.querySelectorAll('[data-popupwithcallback]');
$compile(popupwithcallbacks)(scope);
}
};
}]);
ng.module('popupwithcallback')
.directive('popupwithcallback', function () {
return {
restrict: 'A',
scope: true,
controller: 'PopupWithCallbackCtrl',
controllerAs: 'popupwithcallback',
bindToController: true,
link: function (scope, element, attrs, ctrl) {
element.on('click', function (event) {
event.preventDefault();
ctrl.dialogOpen();
scope.$apply();
});
}
};
});
})(window.angular);
; (function (ng) {
'use strict';
var popupwithcallbackService = function ($http, modalService) {
var service = this;
service.send = function (name, phone, comment) {
return $http.post('PopupWithCallback/addcallback', { name: name, phone: phone, comment: comment, rnd: Math.random() }).then(function (response) {
return response.data;
});
};
service.getParams = function () {
return $http.get('PopupWithCallback/getparams').then(function (response) {
return response.data;
});
};
service.dialogRender = function (title, parentScope) {
var options = {
'modalClass': 'callback-dialog',
'isOpen': true
};
modalService.renderModal(
'modalCallback',
title,
'<div data-ng-include="\'/modules/PopupWithCallback/scripts/templates/modal.html\'"></div>',
'<input type="submit" class="btn btn-middle btn-action" value="Отправить" data-ng-click="callback.send()" data-ng-disabled="modalCallbackForm.$invalid" />',
options,
{ callback: parentScope });
};
service.dialogOpen = function () {
modalService.open('popupWithCallback');
};
service.dialogClose = function () {
//modalService.close('popupWithCallback');
modalService.close('popupWithCallback');
};
service.setVisibleFooter = function (visible) {
modalService.setVisibleFooter('modalCallback', visible);
};
};
ng.module('popupwithcallback')
.service('popupwithcallbackService', popupwithcallbackService);
popupwithcallbackService.$inject = ['$http', 'modalService'];
})(window.angular);