dialogService callback function can't access caller/controller functions
Hi,
I'm working on my first Umbraco package.
The problem that I have right now is that the callback function from the dialog has no access to the functions from the caller controller.
I'm working with TypeScript 1.4.
Here the generated JavaScript controller (caller) code
var Mayhem;
(function (Mayhem) {
"use strict";
var NewRaceController = (function () {
function NewRaceController($scope, notificationsService, dialogService,) {
var _this = this;
this.$scope = $scope;
this.notificationsService = notificationsService;
this.dialogService = dialogService;
$scope.vm = this;
}
NewRaceController.prototype.toggleAddDialog = function () {
this.dialogService.open({
template: "/dialog.html",
callback: this.onCloseAddResultEntryDialog,
dialogData: {
foo: "bar",
bar: "foo"
}
});
};
NewRaceController.prototype.onCloseAddResultEntryDialog = function (value) {
// Here is problem....
// TypeError: this.foo is not a function ...
this.foo(value);
// this.notificationsService.success("Success", "Result has been added");
};
NewRaceController.prototype.foo = function (value) {
console.log("onCloseAddResultEntryDialog", value);
};
NewRaceController.$inject = ["$scope", "notificationsService", "dialogService"];
return NewRaceController;
})();
angular.module("mayhem").controller("Mayhem.NewRaceController", NewRaceController);
})(Mayhem || (Mayhem = {}));
Here the Error message
TypeError: this.foo is not a function
at Object.NewRaceController.onCloseAddResultEntryDialog [as callback] (NewRaceController.js?cdv=2038194122:84)
at Object.angular.module.factory.$q.when.then.scope.submit (umbraco.services.js?cdv=2038194122:1617)
at ResultEntryAddController.addResult (ResultEntryAddController.js?cdv=2038194122:23)
at s (angular.min.js?cdv=2038194122:74)
at Object.$get.e.$eval (angular.min.js?cdv=2038194122:92)
at Object.$get.e.$apply (angular.min.js?cdv=2038194122:92)
at HTMLFormElement.<anonymous> (angular.min.js?cdv=2038194122:156)
at HTMLFormElement.x.event.dispatch (jquery.min.js?cdv=2038194122:5)
at HTMLFormElement.x.event.add.y.handle (jquery.min.js?cdv=2038194122:5)
dialogService callback function can't access caller/controller functions
Hi,
I'm working on my first Umbraco package. The problem that I have right now is that the callback function from the dialog has no access to the functions from the caller controller. I'm working with TypeScript 1.4.
Here the generated JavaScript controller (caller) code
Here the Error message
Here the link to dialogService source:
dialog.service.js
Our help would be greatly appreciated, Thanks Stefan
is working on a reply...