user2879704
user2879704

Reputation:

Update the app's main scope object with dialog box inputs

In my application, I am trying to update the dialog box's text input value into the main controller. $scope.dialogText in main controller is set to the dialog box's text input.

Say, I enter pumpkin in the dialog, and press ok, my app must show,

Dialog box's text comment is pumpkin

Instead it always shows,

Dialog box's text comment is

Jsfiddle is at, http://jsfiddle.net/HB7LU/22555/

Upvotes: 0

Views: 152

Answers (1)

sdfacre
sdfacre

Reputation: 1273

your controller needs to be changed as below: -

myApp.controller('tmplCtrl', function($scope, ngDialog){
  $scope.dialogText = ""
  $scope.loadSuiteDlg = function(){
  var prom = ngDialog.open({template : 'dialog', scope : $scope });
  prom.closePromise.then(function(res){
     $scope.dialogText = res.value;
   });
  };
});

http://jsfiddle.net/knu04nww/

Upvotes: 1

Related Questions