Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngtemplate-loader generated code path variable refers to the absolute path. #83

Open
mddubey opened this issue Jun 10, 2019 · 1 comment

Comments

@mddubey
Copy link

mddubey commented Jun 10, 2019

Hello team,

I am using the ngtemplate-loader and everything works quite fine as expected, as far as I have tested. though I am finding a bit of problem in the code generated after running the webpack command.

This is how I am loading the template

var patietProfileTemplate = require('ngtemplate-loader!../views/patientProfile.html');

This is how the generated code looks like for the template caching:

var path = '/Users/mritunjd/Documents/projects/bahmni/bahmniapps-commons/patient-profile/views/patientProfile.html';
var html = "<div>\n    Some content</div>";
window.angular.module('ng').run(['$templateCache', function(c) { c.put(path, html) }]);
module.exports = path;

Now the value of variable path is absolute file location on my disc. Though I tested this on my vagrant machine and it works fine, so doesn't look like it is actually reading from that path.

My question is why does it refer to absolute path and how to get rid of that. It gives an impression that it will work only in my machine. Let me know if I have missed something.

@dikaso
Copy link

dikaso commented Aug 31, 2020

path is just key in memory so don't worry. c.put is actually $templateCache.put.

Check here https://docs.angularjs.org/api/ng/service/$templateCache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants