Don't send empty commands, use angular model instead of accessing element value directly. Fixes problem with pressing enter will send previous value in history.