Some of the time-saving tips every AngularJS user should know !! - Part 2

Must Read before Reading this Post :


As Discussed in Earlier post ,It was all about High/Architecture level Tips . Let's go through some Low-Level thoughts.

At a Low-Level Thoughts/Tips/Gotchas:


1) Learn and love your console logs -

Sometimes, especially with the digest cycles and angular lifecycle, it's sometimes easier to print your debugs to a console.logs instead of adding breakpoints. It's faster!

2) Get Batarang , the chrome extension - 


That is by far the best way to get into the bowels of AngularJS, and some of the details it provides (performance, dependencies) will make your life super simple and easy

3) Start running your unit tests on every save - 


It will do the work of the compiler, and next time you break any functionality, you can fix it with a simple Undo in your IDE

4) Use the [] notation for listing your dependencies - 

That is

angularApp.controller(['$scope', function($scope) ...

instead of

angularApp.controller(function($scope)...

Both work identical, except the former works even when you minify / uglify your code.


5) Use Module in better way -

angular.module('mjApp') uses an existing module called 'mjApp', and throws an error if it doesn't find it.

angular.module('mjApp', []) creates a new module called 'mjApp'

The difference between these two cause the most headaches when starting a new app. 

These are things I can think of  the top of my head. Hope this helps someone, and good luck!!


Comments

Popular posts from this blog

The Top 15 Google Products for People Who Build Websites

Google Translator using Windows forms

5 Useful Tricks for Ubuntu Power Users