My code works and I don't know why

I’ve been working on 100 days of code trying to up my skills on AngularJS etc. One of the min projects relates to a shopping list where I use angular to bind values to list items and display them. They can then be removed from the list by clicking a small x button.


Having implemented most of the code I wanted to enable the functionality that info is also submitted if the Enter key is pressed (to save clicking on the Add button every time.

I created a small keyDown function (Line 37 in JS window) but suddenly, without putting code in the body of the method the thing worked! I’ve no idea why it works but it works! Anyone know why? Could you explain it to me? :slight_smile: