页面不能用ng-include ="function()"滚动 - 代码不再使用了

Kne*_*erd 5 html javascript internet-explorer angularjs

重要编辑

ng-hide我们为引导程序崩溃删除了该代码,但不会发生此问题,但仍然会发生.我的下一个猜测是以下代码

<div ng-include="getTemplateUrl()"></div>
Run Code Online (Sandbox Code Playgroud)

这是整个指令:

stuffModule.directive('stuffDirective', function ($compile) {
    var oldId = undefined;
    return {
        restrict: 'E',
        scope: {
            model: '='
        },
        link: function (scope, elem, attrs) {
            scope.$watch(function (scope) {
                if (oldId !== scope.model.key) {
                    oldId = scope.model.key;
                    return true;
                }
                return false;
            }, function (newValue, oldValue) {
                if (scope.model.someswitch) {
                    switch (scope.model.someswitch) {
                        case 'condition1':
                            scope.getTemplateUrl = function () {
                                return 'condition1.html';
                            }
                            break;
                        case 'condition2':
                        case 'condition3':
                            scope.getTemplateUrl = function () {
                                return 'condition23.html';
                            }
                            break;
                        default:
                            break;
                    }
                } else {
                    scope.getTemplateUrl = function () {
                        return 'default.html';
                    }
                }
            });
        },
        template: '<div ng-include="getTemplateUrl()"></div>'
    };
});
Run Code Online (Sandbox Code Playgroud)

只是简单的说明,用鼠标滚动它实际上是不可能的,但您可以轻松地在字段中进行选项卡.

PS:它只发生在Internet Explorer 11中,即我们的客户使用的版本.在Firefox中我没有这个问题.

我们更换了代码

因为明天有一个重要的演示文稿,缺少滚动条就像是一个非常大的问题,我们决定删除这段代码并用正常的路由替换它.

感谢所有评论员:)

与ng-hide的原始问题

我有一个简单的页面,我隐藏了一个部分ng-hide.当ng-hide转动false部件被显示时,但是随后页面不可滚动直到我重新加载整个页面.

如果有帮助,它把数据ng-hidefalse来自一个AJAX请求.

编辑1 - 不再相关

这是执行HTTP请求的代码

this.getCall = function (url) {
    var dfd = $q.defer();
    $rootScope.loading = true;
    $rootScope.loadingError = false;
    $rootScope.progressActive = true;
    $rootScope.loadingClass = "progress-bar-info";
    $http.get('http://localhost/something', {
        cache: true
    }).success(function (data) {
        $rootScope.loadingClass = "progress-bar-success";
        $rootScope.progressActive = false;
        $timeout(function () {
            $rootScope.loading = false;
        }, 500);
        dfd.resolve(data);
    }).error(function (data, status, headers) {
        $rootScope.loading = false;
        $rootScope.loadingError = true;
        $rootScope.progressActive = false;
        $rootScope.loadingClass = "progress-bar-danger";
        console.error(data);
        dfd.reject(JSON.stringify(data));
    });
    return dfd.promise;
};
Run Code Online (Sandbox Code Playgroud)

这些属性$routescope用于显示每个HTTP请求的简单进度条.