feat(modal): allow templateUrl to be a function

Fixes #2296