Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 在angular js中打开模型对话框时出错_Angularjs_Angular Ui Bootstrap - Fatal编程技术网

Angularjs 在angular js中打开模型对话框时出错

Angularjs 在angular js中打开模型对话框时出错,angularjs,angular-ui-bootstrap,Angularjs,Angular Ui Bootstrap,我想在我的项目中添加“模型”对话框 我的html代码如下所示: <div ng-controller="bodyController"> <!-- This html would live at the path specified in the controller: path/to/your/modal-template.html --> <button class="btn" ng-click="open()">Open Moda

我想在我的项目中添加“模型”对话框

我的html代码如下所示:

<div ng-controller="bodyController">
    <!-- This html would live at the path specified in the controller: path/to/your/modal-template.html -->
        <button class="btn" ng-click="open()">Open Modal</button>

    <div modal="showModal" close="cancel()">
      <div class="modal-header">
          <h4>Modal Dialog</h4>
      </div>
      <div class="modal-body">
          <p>Example paragraph with some text.</p>
      </div>
      <div class="modal-footer">
        <button class="btn btn-success" ng-click="ok()">Okay</button>
        <button class="btn" ng-click="cancel()">Cancel</button>
      </div>
    </div>

    </div>
我已经在index.html文件中添加了angular UI引导JS。但我仍然没有得到模型对话框。我犯了一个错误

我的错误是:


有谁能建议我如何解决此错误。

这是引导模式的一个示例。我认为您在不使用引导类的情况下尝试的方式

您的代码中有很多问题,因此最好尝试使用示例并根据需要进行开发

<button data-toggle="modal" data-target="#test">CLick</button>
<div class="modal fade" id="test" role="dialog">
            <div class="modal-dialog">
                    <div class="modal-content">
                    </div>
            </div>
</div>
点击

请参阅下文。。这对你有帮助

var-app=angular.module(“MyApp”,“ui.bootstrap”);
应用控制器(“bodyController”,函数($scope,$uibModal){
$scope.open=function(){
var modalInstance=$uibModal.open({
动画:没错,
ariaLabelledBy:“模态标题”,
由“模态体”描述,
模板:`
模态对话框
带有一些文本的示例段落

可以 取消 `, 尺寸:'sm', 控制器:'modalCtrl', 决心:{ 项目:功能(){ //返回$ctrl.items; } } }); modalInstance.result .然后(函数(结果){ console.log('ok'); }, 功能(结果){ console.log('cancel'); }); }; }); 应用程序控制器('modalCtrl',函数($scope,$uibModalInstance){ $scope.ok=函数(){ $uibModalInstance.close(); }; $scope.cancel=函数(){ $uibModalInstance.disclose(); }; });

开放模态

更新问题中显示的错误。错误是什么?有控制台错误吗?把它贴在这里看看我更新的ans
<button data-toggle="modal" data-target="#test">CLick</button>
<div class="modal fade" id="test" role="dialog">
            <div class="modal-dialog">
                    <div class="modal-content">
                    </div>
            </div>
</div>