It's really sad not to write well formatted angularJs code inside emacs, the image below shows what I am saying.
What is happening inside the photo is that the code is already well formatted as it is, but when I create a new line it become like the photo shows.
If any one knows any solution to this problem, it would be so helpful to me. (note i've used angularJs mode but in vain)
update: what i'm expecting is auto indentation is working as the file suggesting which means if the file is indented with 4-spaces so the indent-level would be 4 spaces, if it's 2-spaces the indent-level would be 2-spaces and so on.
what is set now at my .emacs file is
(setq global-tab-width 2) but that doesn't work.
note: i've done what is suggested in Jordon Biondo answer but that forces me to apply this change for Js files only where i need it to be globally applied