angularTemplatecache + gulp not working correctly

52 Views Asked by At

I'm using angularTemplatecache with gulp to put all my HTML in a templates.js file but I keep getting an error and cant seem to get it to work.

Uncaught ReferenceError: module is not defined

This error seems to be originating from templates that have ng-include in them because if I remove them from the templates.js file and load them normally it works. Here is one template that is giving me problems

<div class="box-flight-search" ng-show="showNewFlightSearch">
    <flight-search-options fn-flight-search="onFlightSearch"
                           city-airport-data="citiesAndAirportsData"
                           airv-data="airvsData"
                           ptc-data="ptcData"
                           fare-class-data="fareClassData"></flight-search-options>
</div>
&nbsp;
<div class="box-flight-search" ng-show="showLastPnr && showNewFlightSearch">
    <ng-include src="'app/dashboard/views/dashboard.last.pnrs.html'" />
</div>

<div class="container-fluid" ng-if="!showNewFlightSearch">
    <div class="row">
        <!-- ng-hide="showNewFlightSearch" -->
        <div class="main-search-wrapper">
            <div class="inner animated">
                <uib-tabset active="0">
                    <uib-tab index="0">
                        <uib-tab-heading class="lead">
                            <i class="glyphicon glyphicon-plane"></i>&nbsp; {{::resource.fields.Fields.FLIGHT_SEARCH}}
                        </uib-tab-heading>
                        <br />
                        <ng-include src="getTemplate('flightSearch')"></ng-include>
                    </uib-tab>
                </uib-tabset>
            </div>
        </div>
    </div>
    <div class="row" ng-show="viewLastPnr">
        <ng-include src="'app/dashboard/views/dashboard.last.pnrs.html'"
                    ng-controller="DashboardLastPnrController"
                    ng-init="onInit(false)" />
    </div>
</div>

The getTemplate function i something like this

$scope.getTemplate = function (template) {
    switch (template) {
        case "flightSearch":
            return $scope.viewsPath + "views/dashboard.search_NXG.html";
        case "lastPnr":
            return $scope.viewsPath + "views/dashboard.last.pnrs.html";
        case "queues":
            return $scope.viewsQueues + "views/queues.component.html";
    }
};

any ideia on how to resolve this?

EDIT: here is my template.js. the file has more but i just removed for simplicity

angular.module("AppRoot").run(["$templateCache",function($templateCache){
$templateCache.put("footer.html",'html here'),
$templateCache.put("app/dashboard/views/dashboard.last.pnrs.html",'html here),
$templateCache.put("app/dashboard/views/dashboard.retrieve.reservation.html",'html here')}]);

AppRoot is the root module for the application

0

There are 0 best solutions below