javascript - how to use ng-repeat in partial html files using angular routes -


the following code used part of main html file decided split app, partials , render stuck , don't know how repeat render code more.

<div class="col-md-12" ng-controller="timeslotcontroller calendar" >  <div class="col-md-5 col-md-offset-1 timeblock" ng-repeat="slots in calendar.timeslot" ng-click="calendar.selecttimeslot(slots.time)">     <h3 class="event-type-name">[[ slots.time]] hour appointment</h3>     <div class="description mts">[[slots.description]]</div>     <div class="cost"><i class="fa fa-euro"></i> [[slots.cost ]]</div>  </div> 

this how controller looks right now

app.config(function($interpolateprovider, $routeprovider, $locationprovider) {      $interpolateprovider.startsymbol('[[');     $interpolateprovider.endsymbol(']]');      $routeprovider                 .when('/timeslot', {                     controller: 'timeslotcontroller timerange',                     templateurl:'/views/timeslot.html'                 })                 .when('/calendar', {                     controller: 'calendarcontroller',                     templateurl:'/views/calendar.html'                 })                 .when('/mail', {                     controller: "mailcontroller",                     templateurl: '/views/mail.html'                 })                 .otherwise({                     redirecto: '/timeslot'                 });      $locationprovider.html5mode({                        enabled: true,                        requirebase: false                      });           });   app.controller("timeslotcontroller", function($rootscope, $location, $scope) {      $scope.timeslot = [        {         time:1,         description: "welcome scheduling page. please follow instructions add event calendar.",         cost: "10"       },        {         time:2,         description: "welcome scheduling page. please follow instructions add event calendar.",         cost: "20"       },        {         time:4,         description: "welcome scheduling page. please follow instructions add event calendar.",         cost: "10"       },       {         time:6,         description: "here lies 3",         cost: "10"       }     ];      console.log($scope.timeslot);      $scope.selecttimeslot = function(timeslot) {          $rootscope.timeslot = timeslot;          console.log($rootscope.timeslot);          $location.path('/calendar');     }  }); 

how use ng-repeat in such file types ? looked around little couldn't find looking for.

 ng-repeat="slots in timeslot" 

plunker: http://plnkr.co/edit/imdmhlpevzo6fl2fe2ep?p=preview

as dinesh said, remove calendar when you're specifying controller. unless you're doing more complicated don't know about, angular smart enough know controller you're trying use.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -