Directive for Auto Focus Next element on Enter

There could be requirement when user needs to fill a large form with multiple fields, it would make sense to use the enter key instead of tab to direct user to next form field, so we can achieve this functionality by creating a custom directive and using that with the form fields that need to possess this “auto focus next element on enter key” behavior.

One more use case where such a custom directive could come handy is when the user have a barcode scanner and he/she just need to be able to fill through form fields without touching keyboard/mouse. A typical barcode scanner will scan the barcode, key-in the barcode into focused field and then will fire an enter key pressed event. So a custom directive like below would be a very easy way to implement such behavior.