NZJames NZJames - 2 months ago 19
AngularJS Question

ng-include cannot locate partial html files

I'm trying to implement a basic tabset with each tab getting its content from a separate partial view with it's own controller. I have created three dummy HTML files with basic text only just to test the pipes but I can't seem to get ng-include working. I'm not sure how to use it regarding paths. My HTML files are in /Areas/SEFlex/Views/Home/, my angular controllers are in /app/SEFlex/controllers

This is my tab HTML

<div class="col-md-12">
<tabset>
<tab heading="Jobs" ng-show="AuthService.canRunFlexJobs || AuthService.canRunHighPriorityFlexJobs">
<div ng-include="'SEFlex/Home/Jobs.cshtml''"></div>
</tab>
<tab heading="Models" ng-show="AuthService.canViewFlexModels">
<div>test</div>
</tab>
<tab heading="Administrator" ng-show="AuthService.canAdministerFlex">
<div ng-include="'SEFlex/Home/Administrator.cshtml''"></div>
</tab>
</tabset>
</div>


Have I got the relative paths wrong?

Answer

You just have a syntax error with an extra single quote.

<div ng-include="'SEFlex/Home/Jobs.cshtml'"></div> 
Comments