Skip to content Skip to sidebar Skip to footer

Angularjs: [$compile:tpload] Failed To Load Template

My angularjs example app is running fine in my netbeans ide based local server. But when I moved the application to nginx server it gives me the following error in the browser. Err

Solution 1:

If you use node.js, try this

app.use(express.static(path.join(__dirname,'yourFolder/invoices')));

Solution 2:

I came to find out that my issue was regarding Default $http Headers. I had just recently added a default header for Authorization, and a default Accept for application/json.

SURPRISE!!! It turns out that those $http headers are NOT only applied to $http calls you make to your endpoints... but also to every call made that pulls your Routing html files. And since html files will explode if using those headers, the whole thing fails.

I simply stopped setting the Default $http headers, and wrote a side service that my microservice calls would use since they need app/json. Then my Angular Routing calls went back to using standard headers.

Post a Comment for "Angularjs: [$compile:tpload] Failed To Load Template"