title: Angular/ HTML: After click or press Enter call a function
body: <p>I have a input field and after clicking a button I'm calling a function and get back the right things.
  Now I also want that the function is calling after pressing enter.</p>
  
  <p>At the moment my code looks like this:</p>
  
  <pre><code>&lt;div class="input-group mb-3"&gt;
      &lt;input (keyup)="searchUser($event)" stype="text" class="form-control" placeholder="Suche nach Nachnamen ..."
          aria-label="Recipient's username" aria-describedby="button-addon2"&gt;
      &lt;div class="input-group-append"&gt;
          &lt;button (click)="searchForUser()" class="btn btn-outline-secondary" type="submit"
              id="button-addon2"&gt;Suche&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I already tried to put my div in a <code>&lt;form&gt;&lt;/form&gt;</code>. Then the whole page is reloading.</p>