Search code examples
htmlangularjsangularjs-ng-include

ng include not inputting HTML


Here's a Plunker with the problem in question: https://plnkr.co/edit/3I3DbYle9urs9UwugfpA?p=preview

I've made a very simple example that shows what isn't working. I use ngInclude as follows:

<div ng-include="'header.html'" ng-controller="TestController"></div>

It seems pretty straightforward. I've searched other questions and answers about this topic and now know that I should use single quotes inside double quotes, that I need to be running this on a server (I am), and so on. But no matter what I try, it isn't working.

I'd really appreciate your help!


Solution

  • You need to provide the controller method a function.

    Your code

     angular.module('govExp').controller('TestController', []);
    

    Corrected code

    angular.module('govExp').controller('TestController', [function(){
        //do stuff
    ]);