I really would like to convert the following code to angular 2. Would it consist of writing alot of extra logic? Notice how this is simple and straight to the point.
I have a modal service
angular.module('app').service('myModalService', function ($modal, $http, $filter, $document) {
this.QuestionModal = function (message, title, showButtonNoCancel, buttonYesOK, buttonNoCancel) {
return $modal.open({
backdrop: 'static',
keyboard: false,
templateUrl: 'Scripts/Services/questionModal.html',
controller: function ($scope, $modalInstance) {
$scope.vm = { Message: '', Title: title };
$scope.vm.Message = message;
$scope.YesOkButton = buttonYesOK;
$scope.ButtonNoCancel = buttonNoCancel;
$scope.ShowButtonNoCancel = function () {
return showButtonNoCancel;
}
$scope.Ok = function () {
$modalInstance.close(true);
}
$scope.Cancel = function () {
$modalInstance.dismiss('cancel');
}
}
});
};
I call it like this and get the return value
myModalService.QuestionModal("Do you want to delete the order?", 'Cancel Order', true, "Yes", "No").result.then(
function () {
//handle yes function here
},
function () {
//handle no function here
return;
});