Skip to content

Instantly share code, notes, and snippets.

@killerchip
Last active January 1, 2018 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save killerchip/988e004e76bebc41be296fc1b09af946 to your computer and use it in GitHub Desktop.
Save killerchip/988e004e76bebc41be296fc1b09af946 to your computer and use it in GitHub Desktop.
Angular cheatsheet: Directives / NgFor

NgFor

In this example we also demonstrate how to print an array of strings with a comma separator in between them.

in component

public values = ['one','two','three'];

in HTML template

<span *ngFor="let value of values; let i = index">
  {{value}}
  <span>{{i < (values.length-1) ? "," : ""}}</span>
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment