For some reason referencing an algorithm displays always 0 instead of actual number of the algorithm. References work, I can click on it and it will move me to the algorithm.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{hyperref}
\begin{document}
\section{Introduction}
It doesn't work \ref{alg1} \ref{alg2}.
\begin{algorithm}
\caption{Algorithm 1}
\begin{algorithmic}[ht]
\label{alg1}
\State it's a test
\end{algorithmic}
\end{algorithm}
\newpage
\begin{algorithm}
\caption{Algorithm 2}
\begin{algorithmic}[ht]
\label{alg2}
\State it's a test
\end{algorithmic}
\end{algorithm}
\end{document}

