0

利用responsive-nav.js我正在尝试创建响应式导航。我过去在非角度项目中使用了 responsive-nav.js,没有任何问题。我很难弄清楚如何包含所需的代码。例如,我尝试按照文档中的说明将这行代码放在我的 index.html 文件中的结束 body 标记之前。

<!-- Put this right before the </body> closing tag -->
<script>
  var nav = responsiveNav(".nav-collapse");
</script>

控制台上方的脚本给了我一个错误“responsiveNa 未定义”。

我为 responsive-nav.js 创建了一个指令,但这并没有解决问题。

.directive('responsiveNav', function(){
    return{
        restrict: 'E',

        link:function(scope, element, attrs){

            $(element).responsiveNav("foo",{
                customToggle  : "nav-toggle",
                navClass      : "nav-collapse"


            });
                    Scope.$apply();
        }
    }
});
4

0 回答 0