code updated to work with the latest stable version of angularjs; XSRF protection added