you should use ngResource, makes the whole thing much simpler...