Answer the question
In order to leave comments, you need to log in
What is the best way to serve templates in AngularJS?
I am creating an application in AngularJS, backend - Symfony2. There will be authorization (entrance for employees). I thought about how to store and give templates that Angular loads. I see 2 options:
1. You can simply create an app directory and store html templates along with scripts in it. Then they will be served quickly (bypassing the php framework), and the entire frontend will be in one directory. Minus - they can be downloaded without authorization, that is, if you wish, you can merge the entire application - although without data, it is still not pleasant and dangerous.
2. Submit templates through the framework. Then authorization will always be checked, but you will have to create a route for each template, and in addition, the frontend will be spread out in different places.
Share your experience, which option do you use and why?
Answer the question
In order to leave comments, you need to log in
When deploying, I create a certain number of minified assemblies from the source code and templates (in $templateCache), depending on the user's roles. Authorization - a form with a submission, which, upon successful authorization, gives the necessary file.
Issuing a file with scripts can be done with nginx with the headerX-Accel-Redirect
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question