I have several modules that require some template partials to be loaded whenever the module is used. I am storing these files in a folder called partials inside each module subfolder. My starting point for my app is meanjs, and I am storing partials file are in public/modules//partials/*.html.
I have seen several ng-include and directive examples, but being new to AngularJS each sample I read confuses me further as to what is best practice / most AngularJS appropriate way to do this.
Store your partials whenever you wants. To load them all use angular template cache.
Use Grunt or gulp to generate automatically. Personally I use gulp.
Here is my working example of one of my project.
install nodejs and npm
npm intall gulp -gnpm install gulp-angular-templatecachecreate
gulpfile.jsthen use it like this:
gulp generate- to regenerate partialsgulp watch-partials- watch file changes, if partials are changed it automatically rungeneratetask for you. :)One more thing, dont forget to include template.js in your html file
<script src="public/js/template.js"></script>Every time you change your partial dont forget to regenerate your template cache.