fix(templateCache): make sure $state is passed config options before checking what they are