NZJames NZJames - 1 year ago 132
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">
<tab heading="Jobs" ng-show="AuthService.canRunFlexJobs || AuthService.canRunHighPriorityFlexJobs">
<div ng-include="'SEFlex/Home/Jobs.cshtml''"></div>
<tab heading="Models" ng-show="AuthService.canViewFlexModels">
<tab heading="Administrator" ng-show="AuthService.canAdministerFlex">
<div ng-include="'SEFlex/Home/Administrator.cshtml''"></div>

Have I got the relative paths wrong?

Answer Source

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

<div ng-include="'SEFlex/Home/Jobs.cshtml'"></div> 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download