Template destroyed function not fired when parent is removed