I think so and in practice we have goats in urban towns where the community keep them through feeding on some leftovers of vegetables and others plants in the market days. However since community also plant trees and other through urban agricultural activities and might not happy with the goats cleaver behavior of eating some threes and vegetables. we need to strike a balance here.
I agree with P.G. Wiles stating that goats eating almost any thing in urban areas however in practice these goats exists with less damage to gardens if they are well attended by their owners as a business and of course context of the urban area also matters.