我在这里提供的基础上使用了角指令- http://pineconellc.github.io/angular-foundation
我一直在寻找在他们的一个模态框中使用文本字段。由于某种原因,我看到它对除模型之外的每一个角方向都表现得很好。在输入文本字段中的任何内容并关闭模态窗口后,我无法检索在我的视图中输入的字段中的值,模型总是没有定义。参见下面的演示http://plnkr.co/edit/FT1M2JjfRarZMTCwkOJG?p=preview
{{mytext}}不会产生任何结果。
发布于 2014-11-12 10:13:19
您可以将$scope.selected声明为:
$scope.selected = {
item: $scope.items[0],
myText: ""
}你的$scope.ok是:
$scope.ok = function () {
$modalInstance.close($scope.selected);
};在你的ModalInstanceCtrl里。
这使得访问then函数中的变量变得非常容易:
modalInstance.result.then(function (selected) {
$scope.selected = selected.item;
$scope.myText = selected.myText;
}, ...);您可以查看工作的example。
https://stackoverflow.com/questions/26879691
复制相似问题