I have a controller that creates a dialog with ngDialog.open. I assign scope:$scope and set scope variables with ng-model in the popup $dialog. However the values are not set in the controller $scope. The ng-click function is able to call a function in the $scope.
Is there something I am missing, I have searched quite a bit on here and github, read the docs and worked with all the examples provided on github in the project.
JS Fiddles below explains. It shows that the scope:$scope is not what it seems for .open(). It is a one way binding and does not go back to $scope. .openConfrm() seems to have the expected behavior.
ngDialog.open() - http://jsfiddle.net/s1ca0h9x/ (FIXED!! works like expected)
ngDialog.openConfirm() - http://jsfiddle.net/tbosLoa9/ (works as expected)
var myApplication = angular.module('myApplication', ['ngDialog']);
myApplication.controller('MainController', function ($scope, ngDialog) {
$scope.FormData={newAccountNum:''};
$scope.ShowNgDialog = function () {
ngDialog.open({
template: '<div><input type="text" ng-model="FormData.newAccountNum"/></div>',
plain: true,
scope:$scope
});
}
});
I have edited the original post and added it below. The FIXED link shows it working and the second shows it broken. Adding a dot (using a javascript object) fixes the problem.
ngDialog.open() - http://jsfiddle.net/s1ca0h9x/ (FIXED!! works like expected)
ngDialog.openConfirm() - http://jsfiddle.net/tbosLoa9/ (works as expected)
var myApplication = angular.module('myApplication', ['ngDialog']);
myApplication.controller('MainController', function ($scope, ngDialog) {
$scope.FormData={newAccountNum:''};
$scope.ShowNgDialog = function () {
ngDialog.open({
template: '<div><input type="text" ng-model="FormData.newAccountNum"/></div>',
plain: true,
scope:$scope
});
}
});