javascript - How to use Jquery onload function inside angularjs? -


i using jquery slider inside angularjs function. script file not working inside angular controller. using following code,

 $(window).load(function() {  		  alert("flexslider function");  	     $('.flexslider').flexslider({  	        animation: "slide",  			usecss: modernizr.touch  	      });  	  });
<link rel="stylesheet" href="../bower_components/hosting.css"></link>  	<link rel="stylesheet" href="../bower_components/flexslider.css"></link>  <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css"/>
 <script src="../bower_components/jquery.flexslider.js" type="text/javascript"></script>      <script src="../bower_components/modernizr.js" type="text/javascript"></script>  <script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>  <script type="text/javascript" src="../bower_components/jquery/dist/jquery.min.js"></script>        <div ng-controller="logincontroller">   <nav class="navbar navbar-default navbar-fixed-top" role="navigation">     <div class="container">  <div class="navbar-header">  <h1>demurrage</h1>   </div>     <div class="collapse navbar-collapse navbar-ex1-collapse">  <ul class="nav navbar-nav navbar-right">    <li><a href="" role="button" data-toggle="modal" data-target="#login">login</a></li>    </ul>      </div>     </div>  </nav>     <div class="jumbotron masthead">  <div class="container">     <div class="flexslider">    <div class="flex-viewport" style="overflow: hidden; position: relative;">  <ul class="slides" style="width: 1000%; margin-left: -2280px;">  <li class="clone" aria-hidden="true" style="width: 1140px; float: left; display: block;">  <div class="slide3">  <p class="pull-left"><img src="../bower_components/images/server2.png" alt="server" class="img-responsive" draggable="false"></p>  <h1>demurrage calculator</h1>    </div>  </li>  <li class="" style="width: 1140px; float: left; display: block;">  <div class="hero-unit">  <h1>import cargo</h1>    </div>  </li>    <li style="width: 1140px; float: left; display: block;" class="flex-active-slide">  <div class="slide3">  <p class="pull-left"><img src="../bower_components/images/server2.png" alt="server" class="img-responsive" draggable="false"></p>  <h1>demurrage calculator</h1>    </div>  </li>  <li class="clone" aria-hidden="true" style="width: 1140px; float: left; display: block;">  <div class="hero-unit">  <h1>import cargo</h1>    </div>  </li></ul></div><ol class="flex-control-nav flex-control-paging"><li><a class="">1</a></li><li><a class="">2</a></li><li><a class="flex-active">3</a></li></ol><ul class="flex-direction-nav">  <li><a class="flex-prev" href="">previous</a></li>  <li><a class="flex-next" href="">next</a></li></ul></div>  </div>  </div>     <div class="modal fade loginsignup" id="login" tabindex="-1" role="dialog" aria-labelledby="loginlabel" aria-hidden="true" style="display: none;">  <div class="modal-dialog">  <div class="modal-content">  <div class="modal-header">  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>  <h3 class="modal-title">login</h3>  </div>  <div class="modal-body">    <div class="form-group">  <input class="form-control input-lg" type="text" name="username" size="50" ng-model='username' placeholder="username">  </div>  <div class="form-group">  <input class="form-control input-lg" type="password" id="passw" name="password" size="20" ng-model='password' placeholder="password">  </div>  <div class="form-group">  <input type="submit" value="login" id="login" ng-click="loginuser()" class="btn btn-success btn-lg">  </div>  </div>  </div>     </div>     </div>    </div>

here, have printed 1 alert message, alert msg not printing inside load function. slider not working here. please me how can call load function.

i using following code. working perfectly.

 $scope.load = function () {  	    	$('.flexslider').flexslider({  	            animation: "slide",  	    		usecss: modernizr.touch  	          });	    	  	    }
<div ng-controller="logincontroller" ng-init='load()'>

this 1 using. called $scope.load function inside of using controller url. functionality working.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -