Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to improve performance of a AngularJS app

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.06k
    Comment on it

    Hello readers if you using a long Angular JS app and want to make it's performance better you can see here how to make your app efficient There are two ways of achieving this for a developer namely 1. disabling debug data and 2. enabling strict DI mode.

    The first one can be enabled through the $compileProvider:

    myApp.config(function ($compileProvider) {
      $compileProvider.debugInfoEnabled(false);
    });
    

    That tweak disables appending scope to elements, making scopes inaccessible from the console. The second one can be set as a directive:

    <html ng-app=myApp ng-strict-di>
    

    The performance gain lies in the fact that the injected modules are annotated explicitly, hence they dont need to be discovered dynamically.

    You dont need to annotate yourself, just use some automated build tool and library for that.

    But there are two other popular ways are:

    Using one-time binding where possible. Those bindings are set, e.g. in {{ ::someModel }} interpolations by prefixing the model with two colons. In such a case, no watch is set and the model is ignored during digest. Making $httpProvider use applyAsync:

    myApp.config(function ($httpProvider) {
      $httpProvider.useApplyAsync(true);
    });
    

    which executes nearby digest calls just once, using a zero timeout.

    Source by: toptal

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: