arielsalminen / responsive-nav.js

Responsive navigation plugin without library dependencies and with fast touch screen support.
http://responsive-nav.com
4.07k stars 619 forks source link

problem with angularjs #196

Open chenminhua opened 8 years ago

chenminhua commented 8 years ago

I tried to use this plugin with angularjs. But when I use "ng-if", this plugin does't work for me. I guess it's not this plugin's problem. It's should be some wrong with ng-if. I still can't mark it work. please help me, thx.

HERE IS MY CODE SNIPPET. (in the controller's scope, we have a "login" variable to check if the user has logged in)

<body ng-app="app">
    <div ng-controller="NavigationCtrl">
        <div id="navigation" role="navigation" class="nav-collapse">
            <ul ng-if="login">
                <li><a href="/#/">HOME</a></li>
                <li><a href="/" ng-click="logOut()">LOGOUT</a></li>
                <li><a href="/#/snippet/create">CREATE</a></li>
                <li><a href=""> PROFIRE </a></li>
            </ul>
            <ul ng-if="!login">
                <li><a href="/#/user/signin">LOGIN</a></li>
                <li><a href="/#/user/register">REGISTER</a></li>
                <li><a href="">ABOUT</a></li>
            </ul>
        </div>
        <div class="main" role="main">
            <a href="#nav" class="nav-toggle">MENU</a>
            <div ng-view></div>
        </div>
    </div>
    <script src="./public/responsive-nav.js-master/responsive-nav.js"></script>
    <script src="./public/bower_components/jquery/dist/jquery.min.js"></script>
    <script>
        var navigation = responsiveNav("navigation",{customToggle: ".nav-toggle"})
    </script>
</body>
yuens1002 commented 8 years ago

hi there. i'm also interested in trying this so i read up on some instructions about this plugin. According to the instructions, it says to include

<script src="./public/responsive-nav.js-master/responsive-nav.js"></script> <link rel="stylesheet" href="responsive-nav.css">

within the <head></head> tag. Is it possible this may be causing the issue with ng-if?