Template is not loaded
See original GitHub issueI’m updating my app to use Webpack 2. While ngtable is working fine if loaded with webpack 1, I experience an issue while loading with webpack 2.
The browser console shows GET http://app.finderbox.dev/app/ng-table/pager.html 404 (Not Found)
. In the component loading the table I set some log output:
$templateCache.get('http://app.finderbox.dev/app/ng-table/pager.html'): undefined
$templateCache.get('http://app.finderbox.dev/ng-table/pager.html'): undefined
$templateCache.get('ng-table/pager.html'): Promise {$$state: Object}
It seems to be that ngtable loads templates with a different ID. @TheLarkInn: do you think that it could be an error on the webpack side? @faceleg: is that related to your issue https://github.com/esvit/ng-table/issues/957?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
Template kit not loading - WordPress.org
Hey there, Just been having a play round with Royal elementor but am having a bit of trouble getting the template kits to...
Read more >Template not loading - Stack Overflow
Angular compiles the directives as it goes over DOM. You can't have it "wait" on a directive. What you could do, is not...
Read more >Load or unload a template or add-in program - Microsoft Support
If you quit and then restart Word, the template or add-in is not automatically reloaded. In Word 2010, 2013, or 2016, select File...
Read more >Template Not Loading - Using Django
Hi Everyone I am building a simple blog app using Django. I have created two pages so far: index.html and posts.html. On the...
Read more >Template not loading with get_template_part or locate_template
From your comment: (formatted for brevity). The cute thing is I debugged that TEMPLATE_MODULE_DIR . 'my-template.php' and the path in a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issues with some missing html templates when using ngTable with Webpack 2.2. Importing the ngTable module from the /bundles directory seems to be working properly. But this is more like a workaround for now I guess.
I managed to get the templates loading without any manual steps, by configuring Webpack with the following in my webpack.config.js file (using Webpack 3.11.0):
This also requires the
ngtemplate-loader
andhtml-loader
NPM packages to be installed; once that is done, this config should work as-is for anyone else using Webpack 3.x. (For Webpack 2.x or 4.x, a similar line should work but maybe in a different part of the Webpack config file). This causes Webpack to compile the templates into myvendor.bundle.js
file as follows:Note how the path is
ng-table/pager.html
. TherelativeTo=/src/browser/
part of the Webpack config turnsnode_modules/ng_table/src/browser/pager.html
intopager.html
, and thenprefix=ng-table/
adds theng-table
prefix to the name that ngtemplate-loader compiles it with. This results in Angular’s template cache being pre-loaded with anng-table/pager.html
template, and so when the ng-table code requests theng-table/pager.html
template, Angular finds it and displays it correctly.