Javascript 角度完美滚动条在加载时不工作

Javascript 角度完美滚动条在加载时不工作,javascript,angularjs,angularjs-scope,Javascript,Angularjs,Angularjs Scope,在我的angular应用程序中,我从Json加载数据,并使用完美滚动条。但滚动条只显示当我滚动不显示页面加载。连我都用过 <perfect-scrollbar class="scroller ps-active-y" include-padding='true' wheel-propagation="true" wheel-speed="50" on-scroll="onScroll(scrollTop, scrollHeight)"> 也可以使用此指令 appDirectiv

在我的angular应用程序中,我从Json加载数据,并使用完美滚动条。但滚动条只显示当我滚动不显示页面加载。连我都用过

<perfect-scrollbar class="scroller ps-active-y" include-padding='true' wheel-propagation="true" wheel-speed="50" on-scroll="onScroll(scrollTop, scrollHeight)">

也可以使用此指令

appDirectives.directive('perfectScrollbar', function(){
    return {
        restrict: 'A',
        template: '<div ng-transclude></div>',
        transclude: true,
        scope: {},
        link: function(scope, element, attrs){
            element.perfectScrollbar();

                element.perfectScrollbar('update');

        }
    }
});
appdirections.directive('perfectScrollbar',function(){
返回{
限制:“A”,
模板:“”,
是的,
作用域:{},
链接:函数(范围、元素、属性){
元素。perfectScrollbar();
元素。perfectScrollbar('update');
}
}
});

但请不要提出任何建议。

您当前使用
restrict:'A'
将指令限制为一个属性。你应该试试
。使用
perfect scrollbar
作为属性将匹配指令所期望的内容


或者,您可以将restrict更改为“E”,它代表“Element”。

您当前使用
restrict:'A>将指令限制为属性。你应该试试
。使用
perfect scrollbar
作为属性将匹配指令所期望的内容


或者,您可以将restrict更改为“E”,它代表“Element”。

但是,当我添加“E”时,它会显示错误消息,我在项目中也遇到了这个问题。您遇到了什么错误?请同时尝试
restrict:'EA'
,但当我添加'E'时,它会显示错误消息。我的项目中也会出现此问题。您会遇到什么错误?同时尝试
restrict:'EA'