Using ng-include with controller as syntax

762 Views Asked by At

I need to change the "controller as" name to ctrl in "_restaurantdiv.html" since I am using this partial file in different places under different controllers. Currently I am doing so by writing ng-controller along with ng-include. But the problem is, it reinitializes the controller which I do not want to happen. All I need is just a change in the "controller as" name.

<div ng-controller="resultsController as searchresults">    
  <div class="col-md-3 col-sm-4 pane" ng-repeat="venue in searchresults.venuedetails|orderBy: searchresults.filteroption">
    <div ng-include="'partials/_restaurantdiv.html'" ng-controller="resultsController as ctrl"></div>
  </div>
</div>
0

There are 0 best solutions below