user824624
user824624

Reputation: 8080

angular js can't display bootstrap modal when relocate to another folder

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

Upvotes: 3

Views: 3191

Answers (1)

glepretre
glepretre

Reputation: 8167

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.

Upvotes: 3

Related Questions