Html 如何使用angularJS在模态外部显示模态中的选定项/值/详细信息

Html 如何使用angularJS在模态外部显示模态中的选定项/值/详细信息,html,angularjs,angular-ui-bootstrap,Html,Angularjs,Angular Ui Bootstrap,我需要使用AngularJS在模态外部显示模态中给出的值。这就清楚地解释了。有人能帮我吗…….我已经检查了Angular,Ui引导站点,但找不到问题的解决方案 HTML <div ng-controller="ModalDemoCtrl as $ctrl" class="modal-demo"> <script type="text/ng-template" id="myModalContent.html"> <div clas

我需要使用AngularJS在模态外部显示模态中给出的值。这就清楚地解释了。有人能帮我吗…….我已经检查了Angular,Ui引导站点,但找不到问题的解决方案

HTML

   <div ng-controller="ModalDemoCtrl as $ctrl" class="modal-demo">
<script type="text/ng-template" id="myModalContent.html">
                <div class="modal-header">
                    <button type="button" class="close" aria-hidden="true" ng-click="$ctrl.cancel()">&times;</button><a>
                        <h3 class="modal-title" id="modal-title" style="color:red">Please Provide the Details Here</h3>
                    </a>
                </div>
                <form name="modalForm" novalidate>
                    <div class="modal-body">
                        <div class="form-group" ng-class="{ 'has-error': modalForm.name.$invalid }">   <!--modalForm.name.$touched &&--> 
                            <a>*Name: </a><input name="name"  ng-minlength="3" 
    ng-maxlength="8" ng-model="name" type="text" placeholder="Name" class="form-control" size="10"  style="width: 50%" required />   


                        </div>
                        <div class="form-group" ng-controller="ButtonsCtrl">
                            <a>*Gender: </a><pre>{{radioModel || 'null'}}</pre>
                            <div class="btn-group">
                                <label class="btn btn-success" ng-model="radioModel" uib-btn-radio="'Male'" uncheckable>Male</label>
                                <label class="btn btn-success" ng-model="radioModel" uib-btn-radio="'Female'" uncheckable>Female</label>
                            </div>
                        </div>
                        <div class="input-group" ng-controller="DatepickerPopupDemoCtrl">
                            <a>*Birth Date: Selected date is: <em>{{dt | date:'fullDate' }}</em></a><select class="form-control" ng-model="format" ng-options="f for f in formats" style="width: 50%"><option></option></select><input type="text" class="form-control" uib-datepicker-popup="{{format}}" ng-model="dt" is-open="popup1.opened" datepicker-options="dateOptions" close-text="Close" ng-required="true" alt-input-formats="altInputFormats" style="width: 50%" />

                            <span class="input-group-btn">
                                <button type="button" class="btn btn-default" ng-click="open1()"><i class="glyphicon glyphicon-calendar"></i></button>
                            </span>
                        </div>
                        <p ng-show="modalForm.modalPlace.$error.required">Select service</p>
                        </div>

                        </div>
                    <div class="modal-footer">
                        <button class="btn btn-warning" type="button" ng-click="$ctrl.ok()" ng-disabled="modalForm.$invalid">OK</button>
                        <button class="btn btn-warning" type="button" ng-click="$ctrl.cancel()">Cancel</button>
                    </div>
                </form>
            </script>

<button type="button" class="btn btn-default" ng-click="$ctrl.open()">Open me!</button>

<div ng-show="$ctrl.selected">Name from the modal: {{ $ctrl.name }}</div>
<div ng-show="$ctrl.selected">Gender from the modal: {{ radioModel || 'null'}}</div>
<div ng-show="$ctrl.selected">DOB from the modal: {{ dt | date:'fullDate' }}</div>

&时代;
请在此提供详细信息
*姓名:
*性别:{{radioModel | |'null'}
男性
女性
*出生日期:所选日期为:{dt|Date:'fullDate'}

选择服务

好啊 取消 打开我! 来自模式的名称:{{$ctrl.Name} 来自模态的性别:{{radioModel | |'null'} 来自模式的DOB:{dt|date:'fullDate'}

您要查找的是
modalInstance.result
属性,它是一个承诺,当您关闭模态时(或当您取消模态时,它会被拒绝)会用一个值解决

这些文档已经为您提供了一个简单的示例

var selectedItem = ...
$uibModalInstance.close(selectedItem)
// or
$uibModalInstance.dismiss(selectedItem)
在模态控制器内,您可以使用以下方法关闭/关闭模态

selectedItem
处于激活状态时,传递给启动模式的控制器


因为你的代码不完整我帮不了你更多,这是你真正需要知道的。

模式之外的
在哪里?
模式??你需要在点击确定模式使用事件或服务时再次设置范围值,因为你的点击事件在另一个控制器中。你必须再次基本更新范围值。如plunker演示中所示,在按钮下方的Open me@SaurabhAgrawalThanks,你能给我看看plunker demo/Code@NamdeoKarande,bcz吗?我对Angular.没有很深的了解。它不包含我需要的信息。它只包含基本内容。如何保存textbox/radiomodel/date值并在模式外显示所选值…无论如何,感谢您的回复
var selectedItem = ...
$uibModalInstance.close(selectedItem)
// or
$uibModalInstance.dismiss(selectedItem)