Skip to content

Instantly share code, notes, and snippets.

@chriseugenerodriguez
Last active April 14, 2023 23:58
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 chriseugenerodriguez/ae19c91d4077de176f8c70fa03de1d8b to your computer and use it in GitHub Desktop.
Save chriseugenerodriguez/ae19c91d4077de176f8c70fa03de1d8b to your computer and use it in GitHub Desktop.
Array Loop for Objects (Angular)
import { PipeTransform, Pipe } from '@angular/core';
@Pipe({ name: 'keys' })
export class KeysPipe implements PipeTransform {
transform(value, args: string[]): any {
let keys = [];
// tslint:disable-next-line:forin
for (let key in value) {
keys.push(key);
}
return keys;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment