Video of the incident shows a figure approach the officers' vehicle, before opening fire and running away.
Los Angeles Sheriff Alex Villanueva called the act "cowardly". The suspect remains at large.
Almost 40 US police officers were killed in the line of duty in 2020, FBI statistics show - eight of them were victims of an ambush.
Protesters shouted anti-police slogans and blocked the entrance to the emergency room where the two officers are being treated, police and witnesses said.
Two people were arrested, including a journalist who police said tried to interfere with the arrest of the other detainee and did not identify herself as a member of the press.
The reporter, Josie Huang, tweeted she had "thoughts and videos" to share, while her employer, NPR, said they were "appalled" by her arrest.