Skip to content

Instantly share code, notes, and snippets.

View PedroPovedaQ's full-sized avatar
💭
blogging

Pedro Poveda PedroPovedaQ

💭
blogging
View GitHub Profile
@PedroPovedaQ
PedroPovedaQ / repeat.directive.ts
Created January 5, 2021 15:33
Angular Directive to Repeat without *ngFor (Useful when wanting to print multiple times without array)
import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';
@Directive({ selector: '[ngRepeat]' })
export class RepeatDirective {
constructor(
private templateRef: TemplateRef<any>,
private viewContainerRef: ViewContainerRef
) {}
@Input() set ngRepeat(iterations: number) {