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 the 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.
The officers involved have not been named, but have been described as a 31-year-old woman and a 24-year-old man.
"One male deputy and one female deputy were ambushed as they sat in their patrol vehicle. Both sustained multiple gunshot wounds and are in critical condition. They are both currently undergoing surgery. The suspect is still at large," LA County Sheriffs tweeted.
"This is just a sombre reminder that this is a dangerous job. Actions, words have consequences and our job does not get easier because people don't like law enforcement," Sheriff Villanueva said.
Sharing the footage of the incident, US President Donald Trump, tweeted: "Animals that must be hit hard."
He has made law and order a central part of his bid for re-election.
Responding to the attack, Democratic Californian congressman Adam Schiff said he was praying for the two officers.
"Every day, law enforcement officers put themselves at risk to protect our community," he tweeted. "I hope the perpetrator of this cowardly attack can be quickly brought to justice."