i trying open dialog user can enter name , call method on controller passing result dialog.
class mycontroller { constructor(public $scope, public $dialog) { } addnew() { var t = '<form name="form" novalidate><div class="modal-header">' + '<h3>nova mapa</h3>' + '</div>' + '<div class="modal-body">' + '<p>name: <input ng-model="result" type="text" required/></p>' + '</div>' + '<div class="modal-footer">' + '<button ng-click="close()" class="btn btn-primary" >close</button>' + '<button ng-click="close(result)" class="btn btn-primary" ng-disabled="form.$invalid">save</button>' + '</div><form>'; this.$scope.opts = { backdropclick: false, template: t, controller: 'addnewdialog' }; var d = this.$dialog.dialog(this.$scope.opts); d.open().then(function (result) { if (result) { // not work this.addnewinternal(result) } }); } private addnewinternal(description: string) { //logic here }; } function addnewdialog ($scope, dialog) { $scope.close = () => { $scope.close(undefined); } $scope.close = (result) => { dialog.close(result); }; }
i error "object doesn't support property or method 'addnewinternal' " can please me solve problem? thank you
Comments
Post a Comment