likeastore / ngDialog

Modals and popups provider for Angular.js applications
http://likeastore.github.io/ngDialog
3.14k stars 692 forks source link

closeThisDialog() not working when I send scope #455

Closed seandcoleman closed 8 years ago

seandcoleman commented 8 years ago

I have a page with an object that I want to modify via NgDialog. I have a button on this page that I attach the dialog controller to. I via the dialog controller am sending scope: $scope which successfully is connecting to my object.

However the button in the dialog modal I have is calling a function of the other controller and I am trying to call closeThisDialog();

Example dialog controller: .controller('modalCtrl', ['$scope', 'ngDialog', function ($scope, ngDialog) { ngDialog.open({ template:'/mypath/modalTmpl.html', className: 'ngdialog-theme-default', scope: $scope});

}

modalTmpl.html:


<div class="row">
    <select.....></select
    <button ng-click="otherController.addToObject(selectedItem) && closeThisDialog(1)">ADD</button>
<div>

ng-dialog: ^0.5.8 AngularJS: 1.4.8 browsers: Chrome, firefox

Did I just miss something?

faceleg commented 8 years ago

I have no idea.

You can either:

seandcoleman commented 8 years ago

Thank you. I was able to debug with {{this}} Great call.

faceleg commented 8 years ago

Glad it helped! In case you don't know it, this is also good: https://chrome.google.com/webstore/detail/angularjs-batarang/ighdmehidhipcmcojjgiloacoafjmpfk?hl=en