add attachTo method to template types