Use the separation of variables procedure on the angular equation
$$\mathbf{L}^2 Y\left(\theta,\phi\right)=A\hbar^2Y\left(\theta,\phi\right)$$
$$\mathrm{where}\,\,\,\mathbf{L}^2= -\hbar^2\left[{1\over \sin\theta}{\partial\over\partial\theta}\left( \sin\theta{\partial\over\partial\theta}\right)+{1\over\sin^2\theta} {\partial^2\over \partial \phi^2}\right]$$
to obtain the following two equations for the polar and azimuthal angles:
$$\left[\frac{1}{\sin\theta}\frac{d}{d\theta}\left(\sin\theta\frac{d}{d\theta}\right)-B\frac{1}{\sin^2\theta}\right]\Theta(\theta)=-A\Theta(\theta)$$
$$\frac{d^2 \Phi(\phi)}{d\phi^2}=-B\Phi(\phi)$$