Using ngResource instead of doing all ajax calls manually