0

My HTML views are growing in size

  1. What is the preferred method to break out views into smaller components? Would ng-include be acceptable here? Note: These components will NOT be reusable. They will solely be used in the particular page that I'm viewing, for the purpose of breaking the page up and making it more readable. Directives feel like overkill for this.

  2. More of an higher-level question, but is the above (i.e. creating non-reusable view partials) considered acceptable practice for Angular apps? Does it go against some common dogma that I'm unaware of?

Thanks!

Edit The reason why it's lengthy is not because of any text. All text is loaded the correct Angular way {{ ctrl.MyText }} for example.

However, the the HTML portion. Example (this is not complete, but just shows an illustration how things can get messy)

<header></header>
<top-nav></top-nav>
<main-banner></main-banner>

<div class="left">
    <div class="content-wrapper">
        <div class="content">
            <div class="tab-wrapper">
                <ul>
                    <li>Tab1</li>
                    <li>Tab2</li>
                </ul>
                <div class="tab-content-wrapper">
                    <div class="tab-content" data-tab="1">
                        <div class="left"></div>
                        <div class="right"></div>
                        <div class="clear"></div>
Ricky
  • 2,850
  • 5
  • 28
  • 41
  • use css to truncate lenghty if it is text? – YOU Oct 06 '15 at 14:20
  • 1
    Possible duplicate of [How do I use Angular JS as a templating engine?](http://stackoverflow.com/questions/14072192/how-do-i-use-angular-js-as-a-templating-engine) – isherwood Oct 06 '15 at 14:22
  • It's hard to answer such a broad question in an objective manner. Why is your view lengthy? Rather than includes, should you be loading content with ajax? Should it even all be on the same page? Maybe routing is a better approach. – isherwood Oct 06 '15 at 14:24
  • 1
    @YOU Sorry, I'm not sure what you mean by this – Ricky Oct 06 '15 at 14:30
  • @isherwood: I've included an edit to explain a bit more detail. Everything is loaded with Ajax. Just the HTML part itself gets lengthy. I'll check out your link – Ricky Oct 06 '15 at 14:31
  • ignore my prev msg if it is not about text length. you worry about because there is so many tags? you can use ng-include, but there is some performance trade-offs. – YOU Oct 06 '15 at 14:36

0 Answers0