3

I am using the bootstrap.ui modal and angular as the frontend, and using the node.js as the backend, in the node.js based server, I used /views folder for ejs template and public folder for storing static resources.

app.set('views',__dirname+'/views');
app.engine('.html', ejs.__express);
app.set('view engine', 'html');

app.use(express.static(__dirname+'/public'));

Previously my angular page is in the /public static folder, the modal works fine. but then I moved the angular page to the view folder, the page is loaded fine. but when it comes to the modal, the page can't display the modal, showing error

Error: [$compile:tpload] http://errors.angularjs.org/1.2.7/$compile/tpload?p0=template%2Fmodal%2Fwindow.html

http://errors.angularjs.org/1.2.7/$compile/tpload?p0=template%2Fmodal%2Fbackdrop.html

So the error is caused by the fact that template/modal/window.html and template/modal/backdrop.html are still in the public folder, that my angular page can't find these file again.

Now even I relocate the template folder from public to views, it still doesn't work, how can I fix this problem

user824624
  • 7,077
  • 27
  • 106
  • 183
  • Does the problem come from the hardwritten `templateUrl` in [modal.js](https://github.com/angular-ui/bootstrap/blob/master/src/modal/modal.js) (lines 64 & 86)? – glepretre Feb 20 '14 at 15:14
  • Thanks, glepretre, I just change 'template/modal/window.html' to '/template/modal/window.html', and now it works. if you put it as the solution, I will approve it – user824624 Feb 20 '14 at 15:55

1 Answers1

3

I think that the problem comes from the hardwritten templateUrl in modal.js source code (see lines 64 & 86)?

There's a debate about this implementation: Github PR, Github issue.

glepretre
  • 8,154
  • 5
  • 43
  • 57