angular factory snippet updated