Converted templateUrl to a function to make it more flexible and use the configured root template path