angularjs - Javacript not working in materialize sidenav using angular ngInclude? -
i implementing angularjs's ng-include
header in materialize framework.i'm using xampp apache local server.
ng-include working correctly in mobile view sidenav()
not working.in chrome browser's console i'm getting message
i guess i'm doing silly mistake can't figure out.please help.
check link: filename = index.html, ext = .html
the project present in below structure
demo -css --site.css -js --site.js --app.js -vendor --css ---materialize.min.css --js ---angular.min.js ---materialize.min.js index.html header.html
index.html
<!doctype html> <html> <head> <meta charset="utf-8" /> <link href="http://fonts.googleapis.com/icon?family=material+icons" rel="stylesheet"> <link type="text/css" rel="stylesheet" href="vendor/css/materialize.min.css" media="screen,projection" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> </head> <body class="light-green lighten-2" ng-app="myapp"> <div ng-include src="'header.html'"></div> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <script type="text/javascript" src="vendor/js/materialize.min.js"></script> <script type="text/javascript" src="js/site.js"></script> <script type="text/javascript" src="vendor/js/angular.min.js"></script> <script type="text/javascript" src="js/app.js"></script> </body> </html>
header.html
<nav> <div class="nav-wrapper"> <a href="#!" class="brand-logo"> logo</a> <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a> <ul class="right hide-on-med-and-down"> <li><a href="sass.html">sass</a></li> <li><a href="badges.html">components</a></li> <li><a href="collapsible.html">javascript</a></li> <li><a href="mobile.html">mobile</a></li> </ul> <ul class="side-nav" id="mobile-demo"> <li><a href="sass.html">sass</a></li> <li><a href="badges.html">components</a></li> <li><a href="collapsible.html">javascript</a></li> <li><a href="mobile.html">mobile</a></li> </ul> </div> </nav>
app.js
var myapp = angular.module("myapp", []);
site.js
$(".button-collapse").sidenav();
Comments
Post a Comment