Javascript 打开和关闭时出现$uib模式错误

Javascript 打开和关闭时出现$uib模式错误,javascript,angularjs,html,twitter-bootstrap-3,angular-ui-bootstrap,Javascript,Angularjs,Html,Twitter Bootstrap 3,Angular Ui Bootstrap,我在打开一个简单的模式弹出窗口时遇到问题 我使用的是uib引导14.3、angular.js 1.4.7和引导3.3.5 我遵循了我在网上找到的文档和示例,即使使用了一个空白的模式模板,没有引用模板中的项目,我也会遇到同样的错误。现在,我传递到模式弹出窗口中的一些对象具有长的JSON日期格式的DateTime成员 在我的HTML中,我在一个表中有一个详细信息按钮,在数据库日志记录上有ng repeat,该记录由索引跟踪: <a href="#" class="btn btn-default

我在打开一个简单的模式弹出窗口时遇到问题

我使用的是uib引导14.3、angular.js 1.4.7和引导3.3.5

我遵循了我在网上找到的文档和示例,即使使用了一个空白的模式模板,没有引用模板中的项目,我也会遇到同样的错误。现在,我传递到模式弹出窗口中的一些对象具有长的JSON日期格式的DateTime成员

在我的HTML中,我在一个表中有一个详细信息按钮,在数据库日志记录上有ng repeat,该记录由索引跟踪:

<a href="#" class="btn btn-default" ng-click="open('lg', $index)">Details <i class="fa fa-eye"></i></a>
模态控制器:

angular.controller('ModalInstanceCtrl', function ($scope, $uibModalInstance, item) {
     $scope.item = item;

     $scope.selected = {
         item: $scope.item
     };

     $scope.ok = function () {
         $uibModalInstance.close($scope.selected.item);
     };

     $scope.cancel = function () {
        $uibModalInstance.dismiss('cancel');
     };
});
模态模板:

<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header">
            <h3 class="modal-title">Item</h3>
        </div>
        <div class="modal-body">
            <p>{{item}}</p>
        </div>
        <div class="modal-footer">
            <button class="btn btn-primary" type="button" ng-click="ok()">OK</button>
             <button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
        </div>
    </div>
</div>
item变量正在从asp.net后端引用此对象3个整数、1个字符串和1个datetime对象


奇怪的是,即使我没有任何引用日期的内容,我仍然会看到日期解析提供程序错误。

您的问题不在模式中。放入带有抛出异常的服务器端数据的PlunkJSON对象,并检查差异。 我想这会对你有用的。其主要思想是,您必须将json日期转换为js日期,或者使用内置的json过滤器

{{item | json}}

你的问题不在模态中。放入带有抛出异常的服务器端数据的PlunkJSON对象,并检查差异。 我想这会对你有用的。其主要思想是,您必须将json日期转换为js日期,或者使用内置的json过滤器

{{item | json}}

好吧,疯狂的是,我在Plunker中得到了它,但在我的项目中没有。我试着用与我的Plunker示例类似的代码简化它。但是,我仍然看到一个日期解析错误。在您的plunk中,您在模式上打印了常量字符串,这没问题,但在应用程序中,您尝试打印带有日期和Get error的json对象,您必须为plunk中在应用程序中引发错误的项指定相同的值。另外,如果它让您感到困惑,最好删除模式代码,没关系,您可以稍后使用,但现在只留下一个带有服务器端json数据的变量,并尝试打印出来,了解差异。好吧,疯狂的是,我让它在Plunker中工作,但不在我的项目中。我试着用与我的Plunker示例类似的代码简化它。但是,我仍然看到一个日期解析错误。在您的plunk中,您在模式上打印了常量字符串,这没问题,但在应用程序中,您尝试打印带有日期和Get error的json对象,您必须为plunk中在应用程序中引发错误的项指定相同的值。此外,如果它让您感到困惑,最好删除模式代码,没关系,您可以稍后使用,但现在只留下一个带有服务器端json数据的变量,并尝试打印出来,了解差异
TypeError: Cannot read property 'attr' of undefined

at Function.extend.removeClass (angular.js?v=122215174314:3568)
at m (angular-animate.js:1141)
at F (angular-animate.js:1198)
at angular-animate.js:889
at afterAnimating (ui-bootstrap-tpls-0.14.3.js?v=122215174314:3834)
at processQueue (angular.js?v=122215174314:14745)
at angular.js?v=122215174314:14761
at Scope.$eval (angular.js?v=122215174314:15989)
at Scope.$digest (angular.js?v=122215174314:15800)
at Scope.$apply (angular.js?v=122215174314:16097)
{{item | json}}