Angular *ngIf and *ngFor: Common Patterns and Pitfalls
The two structural directives every Angular template uses constantly — and the one thing Angular actively forbids: putting both directly on the same element at once.
TOPIC
The two structural directives every Angular template uses constantly — and the one thing Angular actively forbids: putting both directly on the same element at once.
Passing the same data (a site name, a list of categories for a navbar) into every single controller method that returns a view doesn't scale — View::share() and view composers exist to avoid exactly that repetition.
A full framework, not a library — the distinction that actually shapes how building an Angular app differs from a lighter tool like React or Vue, beyond just syntax.
Artisan's make: commands scaffold boilerplate consistently — the useful part is the flag shortcuts that generate a model together with its migration, factory, and controller in one command.
Every component in Angular is technically a directive too — understanding the three-way split (component, structural, attribute) clarifies why *ngIf, [ngClass], and a custom component all count as the same underlying concept.
Beyond a basic Route::get(), the features that actually shape a real app's routes are parameters, route model binding, named routes, and grouping shared middleware or prefixes together.
*ngFor only iterates arrays and other iterables natively — looping over a plain object's keys and values needs either the built-in KeyValue pipe or converting the object first.
php artisan make:component, passing data as props, and the difference between a class-backed component and an anonymous view-only one.
A pipe transforms a value for display, right in the template, without touching the underlying data — the built-in set covers formatting basics, and a custom pipe extends the same pattern to anything else.
Shorter syntax is the visible part — the change that actually matters is how arrow functions handle this, which is what makes them the right (and sometimes wrong) choice in specific situations.
The three visibility keywords control where a property or method can actually be accessed from — the distinction between protected and private specifically comes down to whether a subclass gets access too.
PHP classes can only extend one parent — traits are the language's answer to needing the same reusable method in several otherwise-unrelated classes without that single-inheritance limit getting in the way.