Creating a simple login with AngularJS
There is much wrong with your code..


You are iterating over every record to find a username, what happens if you have lots of users ?
You are not verifying the password !?
It seems like you are exposing the REST services with all the user id's and passwords !?
It seems that if the user knows the /loggedin URL, then the user can skip logging in since you do not validate loggedIn anywhere. Even worse, loggedIn is a variable local to LoginCtrl.


It is good to try and write everything yourself, it brings valuable experience. But please, use this only for throwaway websites.