Let's say we have a cannonball that can shoot at various angles. How would we find the minimum velocity for this projectile to leave the Earth when the cannonball is shot at an angle $\theta$. I think the answer relies on $\theta$ but I am not sure what $\theta$ is.
The answer is surprisingly independent of $\theta$.
All orbits are either circles, ellipses, parabolas or hyperbolas. If you shoot a cannonball into space, and it doesn't enough energy to enter a parabolic or hyperbolic trajectory, it will be a circle or an ellipse (or, as G. Smith points out, the degenerate ellipse which is a line). This means that the orbit always intersects where you shot the cannon from. All circular or elliptic orbits of a cannonball cannot "leave earth." They will always come right back to where they were shot from.
You need enough energy to enter a hyperbolic trajectory. The velocity required is known as "escape velocity", and for earth it is roughly 11.2km/s. The key to this number is that your kinetic energy is greater than your gravitational potential energy, so you can climb forever out of Earth's gravity well without ever slowing down to 0m/s. The energy turns out to be what matters, not the direction of the velocity (unless you point the cannon down. That's a very short experiment).
For a rocket to enter orbit, it can't rely on a single impulse like your cannon ball. This can be done in one long burn, but its common to do 2 burns. The first gets you most of your energy on a very elliptical orbit, and the second circularizes the orbit so that you aren't on a terminal trajectory right back through your own launchpad.