0

I'm using angular UI modal, in the template of my modal I have 2 inputs and a button, this are using th ng-model attribute, ok, I have a controller set for the modal, which works, it does everything but getting the values of the inputs even when I set a value in the controller for the input it changes it, but when I try to get the value from the template I got an undefined response, I make this plunker and kinda insert my modal and made a controller for it one button sets a predefined value in the input and the other one tries to get it , I hope somebody could help me, thx

http://plnkr.co/edit/7NCbo28DbDc8vkxjE2gx?p=preview

1
  • you plunker is not available. Commented Apr 30, 2014 at 19:15

1 Answer 1

2

The modal window has its own scope. What you'll want to do is take your model and make it an object. So take bootusername and name it something like bootusername.text

You can then initialize bootusername in the instance controller and set the model like so:

var ModalInstanceCtrl = function ($scope, $modalInstance) { $scope.bootusername = {}; //initialize the object $scope.check1 = function() { $scope.bootusername.text = 56; //set the object here or just type in input }; $scope.check2 = function() { console.log($scope.bootusername.text); }; $scope.ok = function() { $modalInstance.close($scope.selected.item); }; $scope.cancel = function() { $modalInstance.dismiss('cancel'); }; }; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.