Move delete button logic into a directive