A facile route to viologen functional macromolecules through azide-alkyne [3+2] cycloaddition.