move templates into a separate module and correctly decorate $state service