Premium

Angular Dynamic Table (Rows × Columns)

By FrontendAtlas Team · Updated Jan 30, 2026

Given user input for the number of rows and columns, render a table grid dynamically. Use an Angular standalone component with form bindings and *ngFor loops to generate the table structure. Concepts: components, dynamic-ui, forms. Angular focus: generate rows/cols with *ngFor and template bindings.

  • Use a standalone Angular component as the root component.
  • Provide two numeric inputs: one for the number of rows and one…

What you’ll build / What this tests

This premium angular coding focuses on Angular Dynamic Table (Rows × Columns). You’ll apply components and dynamic-ui thinking with easy level constraints. The prompt emphasizes Given user input for the number of rows and columns, render a table grid dynamically. Use….

Learning goals

  • Translate the prompt into a clear angular API signature and return shape.
  • Apply components, dynamic-ui, forms techniques to implement angular dynamic table (rows × columns).
  • Handle easy edge cases without sacrificing readability.
  • Reason about time/space complexity and trade-offs in angular.

Key decisions to discuss

  • Define the exact input/output contract before coding.
  • Prioritize predictable edge-case handling over micro-optimizations.

Evaluation rubric

  • Correctness: covers required behaviors and edge cases.
  • Clarity: readable structure and predictable control flow.
  • Complexity: avoids unnecessary work for large inputs.
  • API discipline: no mutation of inputs; returns expected shape.
  • Testability: solution is easy to unit test.

Constraints / Requirements

  • Use a standalone Angular component as the root component.
  • Provide two numeric inputs: one for the number of rows and one for the number of columns.
  • Provide a button (e.g. "Generate table" or "Update") that rebuilds the table when clicked.
  • Render an HTML table whose number of rows and columns matches the user-input values.
  • Each cell should render something simple and visible (e.g. its row/column index like R1C1).
  • Initially, no table or an empty grid is fine, as long as it appears correctly after the first…
  • Changing the row or column input and clicking the button updates the table dimensions.
  • If the user enters non-positive values (0 or negative), the implementation may treat them as 0 and render…
  • Use regular class properties (e.g. rowInput, colInput) to store the current input values.
  • Use additional arrays (e.g. rows: number[] and cols: number[]) for driving *ngFor loops.

Mini snippet (usage only)

// Example usage
const input = /* angular dynamic table (rows × columns) input */;
const result = solve(input);
console.log(result);

// Edge case check
const empty = input ?? null;
const fallback = solve(input);
console.log(fallback);

// Expected: describe output shape, not the implementation
// (no solution code in preview)

Common pitfalls

  • Mutating inputs instead of returning a new value.
  • Skipping edge cases like empty input, duplicates, or nulls.
  • Overlooking time complexity for large inputs.

Related questions

Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.