angularjs - My directive stopped working when I started using ng-repeat with a different controller. What am I doing wrong? -


so followed guide have nav bar on every page: http://tomaszdziurko.pl/2013/02/twitter-bootstrap-navbar-angularjs-component/

and working, until created separate controller populate bootstrap carousel. thing is, ng-repeat works fine, when can't see navbar on page. can see fine on other pages. believe scoping issue, not sure where.

this have in main body of page:

<body>     <reusable-navbar></reusable-navbar>      <!-- carousel start -->     <div id="main-carousel" class="carousel slide container" data-ride="carousel">       <!-- wrapper slides -->       <div class="carousel-inner">         <!--must set hand-->         <div class="item active">                 <img alt="" src="../revamp/images/carousel/1.jpg">         </div>         <!--repeat through rest-->         <div ng-controller="carouselphotocontroller">             <div class="item" ng-repeat="source in source">                     <img alt="" ng-src="{{source.source}}">             </div>         </div>       </div>     </div> 

and controller looks this:

var carouselphotocontroller=angular.module("revampapp", []);  carouselphotocontroller.controller("carouselphotocontroller", function($scope, $http){     $http.get('../revamp/images/carousel/photos.json').success(function(photos){         //carousel photos         $scope.source = photos;     }) }); 

and directive identical 1 in walk through, different template. how nav bar show , can use ng-repeat?

make sure not recreating app.

this creates new app:

var carouselphotocontroller=angular.module("revampapp", []); 

but accesses app created (note absence of second parameter):

var carouselphotocontroller=angular.module("revampapp"); 

change above line , should work.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -