EzDevInfo.com

grunt-html2js

Grunt plugin for converting AngularJS templates to JavaScript

using ng-include along with $templateCache not finding file

I have a directive, where I'm trying to dynamically load different partials depending on an object that is injected into directive

function countSummary() {
    var directive = {
        scope: {
            countData: '='
        },
        link: link,
        template: '<div ng-include=\'countData.countType === "expected" ? ' +                         '"/app/count/countsummary/countExpected.html" :' +
                   '"/app/count/countsummary/countBlind.html"\'>' +
                   '</div>'
    }
    return directive;

    function link(scope, element, attrs) { ... } 
}

I'm using grunt-html2js to convert all html files to be added to $templateCache. I have verified that the html file is in added to $templateCache, however when I load the page it is having difficulty finding only the .html files that are referenced in the template function.

Is this a timing issue of any sort? Is there a better way to use the template function?


Source: (StackOverflow)