javascript - ng-include html load controller on demand -
i have angularjs application in loading html file through url configured in app.js
.state('tvslide', { url: '/tvslide', templateurl: 'views/tv_slide.html', controller: 'tvslidecontroller' }) now, in tv_slide.html file, have div in doing ng-include load other html file
<div ng-repeat="eachslide in slides"> <div ng-include="eachslide.templateurl"></div> </div> slides can of count (say 10) , dynamic. each templateurl, need controller want include in templateurl html file only. because there can many controllers , don't want add of them @ start of application index.html
ex: eachslide.templateurl = slide1.html
in slide1.html, there 1 controller as
<div ng-controller="slide1controller"> content </div> i want controller included in same html file
<script src="js/slide1_controller.js"></script> <div ng-controller="slide1controller"> content </div> i don't want load in home page index.html
please suggest way this
Comments
Post a Comment