refactor(Angular.js): remove code duplication

Closes #2890