refact(ngSwitch): don't create extra function in for loop

Closes #8927