Refactor ctxmenu operation into directive. Change all console.log to