Switched from factory to provider so that templates can be defined in app.config() phase. Also code was auto formatted.