question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grunt Dist Server won't load ng-templates, looks for views directly even though ngTemplates are generated.

See original GitHub issue

Hi Eric & everyone!

I spent 5+ hours and looked at the previous issues, but I can’t seem to crack my issue. Hopefully you can provide some insight.

When I run my grunt serve:dist after I built, my app looks for the templates directly, even though my scripts has my generated templates included and my tmp folder has a fully created templateCache.js with all my views in js.

My chrome browser goes crazy looking for the first template in my initial state, i’m using ui-router for angular states. It won’t load the first state template, nor will it load directly referenced templates. However in my regular grunt serve I have no errors. No console errors. Nothing. Every feature works fine.

I read previously to check all my formats, I can confirm that there are no ng-includes or templateUrl in my App.js which has an irregular format. But again all references work fine in my grunt serve version, just not my dist serve.

If I copy and past the views folder (I am using the yeoman generated format) into my dist, the templates come right up, but obviously I want my angular app to recognize my templates.

Last thing I changed my logic for one of my views trying to be fancy with the ngClass…

<div ng-class="toggleSideMenuNavView()" class="baseSideNav">
    <div ng-include=" 'views/Shared/_SideMenu.html' "></div> (<- spaces for distinction)
</div>

Let me know what additional information you may need and thank you to you and everyone in advance.

Dennis O.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
daniel-nalbachcommented, Feb 26, 2016

@underscorebrody - Thanks! His answer caused me to look at syntax around my issue. It turned out that my app folder name for the angular module was camelcase, but the module name itself was lowercase. In our build process, we use the module name as part of the new templateUrl path. That meant the view was declared in our route as templateUrl: xxXX/… but the build path was actually xxxx/, which explains why a static html file was being looked for outside of the templateCache.

0reactions
underscorebrodycommented, Feb 26, 2016

@daniel-nalbach I believe he means his immediately invoked function expression (IIFE).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular / grunt failed to load template - Stack Overflow
It sounds like your build process with Grunt isn't quite configured correctly. Are you using html2js to include the HTML templates in dev...
Read more >
ericclemmons/grunt-angular-templates - GitHub
Grunt build task to concatenate & pre-load your AngularJS templates ... even though grunt-usemin generates a concat.generated object behind the scenes.
Read more >
AngularJS - Azure From The Trenches
Below I'll present one way using the Yeoman generated Angular template as a sample which, using grunt, builds to a folder called dist....
Read more >
grunt.template - Grunt: The JavaScript Task Runner
The template argument will be processed recursively until there are no more templates to process. The default data object is the entire config...
Read more >
Getting started · Bootstrap 3.3.5 Documentation - BootstrapDocs
An overview of Bootstrap, how to download and use, basic templates and examples ... WARNING: Respond.js doesn't work if you view the page...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found