On Monday, May 11, 2015 at 1:44:56 PM UTC-4, Steve Husting wrote:
>
> I understand that a SPA project is composed of a single HTML page. But 
> when making an SPA with AngularJS, one may end up using few or many 
> partials, which are all HTML pages. This confused me. Why are the partials 
> not on the home page to make it one HTML page? 
>
> Pardon if the question is naive. I'm new at this. 
>

Late to the party, some extra answers for you. First, you can put all your 
partials on the home page if you want. Embed them with something like: 

<script type="text/ng-template" id="temp1.html">

Angular processes that into the template cache with the id of temp1.html, 
similar to the URL you would have used. You can then reference it with a 
URL that is temp1.html.

Alternatively, people use build systems (gulp, grunt, etc.) to combine all 
of the templates into a single .js file which shoves strings for each 
template into the template cache. That JS file is then included into your 
main HTML file.

Beyond that, an infinite variety of options. For example, I use CommonJS to 
do a require() inclusion of the template as a string in my directive etc. 
usage. browserify (via an add-on) then does the right thing during build 
time.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to