Reputation: 1271
I am using the angular directives for foundation provided here - http://pineconellc.github.io/angular-foundation
I ve been looking to use a text field within one of their modal boxes. For some reason i see that it behaves properly for every angular directive except the model. After inputting anything in the text field and closing the modal window, i cant retrieve the value entered in the field within my view, the model is always undefined. See demo below http://plnkr.co/edit/FT1M2JjfRarZMTCwkOJG?p=preview
{{mytext}}
Doesnt yield anything.
Upvotes: 1
Views: 196
Reputation: 3133
You could declare the $scope.selected
as:
$scope.selected = {
item: $scope.items[0],
myText: ""
}
And your $scope.ok
as:
$scope.ok = function () {
$modalInstance.close($scope.selected);
};
In your ModalInstanceCtrl
.
This makes it easy to access the variables in the then
function:
modalInstance.result.then(function (selected) {
$scope.selected = selected.item;
$scope.myText = selected.myText;
}, ...);
You can check out the working example.
Upvotes: 1