0

I am working on very large application using angularjs in front-end . In my project there are various modules and each modules are project in itself like school management is a module in my application .

What I have found when the application initially loads , the DOM size is almost 25 mb . And I am in middle of the project only. After using project for sometime , my browser hung-up and at that time DOM size is almost 120 mb and above .

Please suggest some way to configure my project , how I organize directives , controllers and services . How I bind them . I know there is some error in architecture design of my application , binding of controllers etc

Abhimanyu
  • 705
  • 7
  • 20

1 Answers1

1

All 25MB required on pageLoad? Not probably!

You should use RequireJS for big JS applications. This will also help you to manage your modules in structured manner, and browser memory management becomes efficient.

Split all big modules in submodules and make isolated from another.

Eg.

Root APP

  • Module Common = app.module('mCommon')
    • Services
    • Directives
    • Filters
    • Templates
  • Module A = app.module('mA', ['mCommon'])
    • Services that would be used only in Module A
    • Directives that would be used only in Module A
    • Controllers/Filters that would be used only in Module A (Use RequireJS to load this module, load common and load only required controller and services - dont call all files.)
    • Templates only to be used in module A
  • Module B = app.module('mB', ['mCommon'])
    • Follow as Module A
  • Module C
  • CSS
  • Images

Hope this helps!

absqueued
  • 3,013
  • 3
  • 21
  • 43
  • it seems that DOM also keep increasing , when i keep using my application . I new to angularjs . please help – Abhimanyu Mar 13 '15 at 04:50
  • Use UI Router (https://github.com/angular-ui/ui-router) rather simple angular-route as feature. You should use templateUrl feature for views to load only required HTML for each views. This way once you go from one page to another - your DOM will have only new HTML, old one would go away. Lighter HTML page. – absqueued Mar 13 '15 at 06:46