Introducción a Angular y Fundamentos
Aprende Angular 17
Creando tu primer proyecto en Angular
Implementando estilos
Mostrando elementos
Property Binding en Angular
Event Binding: click y doble click
Event binding: keydown
Modelo de reactividad con Signals
Creando un Signal en Angular
Estructuras de control en Angular
Directivas de control
Uso de ngFor
ngFor para objetos
Update Tasks
Uso de ngIf
Uso de ngSwitch y ngSwitchDefault
Controlando un input
Manejo de formularios en Angular
Alistando tu aplicación para producción
Estilos al modo Angular
Clases en Angular
Editing mode
Estados compuestos con computed
Usando effect para localStorage
Uso de ngbuild
Despliegue con Firebase Hosting
Nueva sintaxis en Angular
Directivas @For, @switch
Migrando a la nueva sintaxis de Angular v17
Componentes Reutilizables y Comunicación
Construyendo un e-commerce en Angular
Componentes en Angular
Mostrando los componentes
Angular DevTools
Uso de Inputs en Angular
Uso de Outputs en Angular
Componentes para Producto
Ciclo de vida de los componentes
Ciclo de vida de componentes
Ciclo de vida de componentes: ngOnChanges
Ciclo de vida de componentes: ngOnInit
Detectando cambios en los inputs
Evitando memory leaks con ngDestroy
Audio player con ngAfterViewInit
Creando la página "about us" o "conócenos"
Mejorando la interfaz del producto
Creando componente de productos
Creando el Header
Creando el carrito de compras
Comunicación padre e hijo
Calculando el total con ngOnChanges
El problema del prop drilling
Reactividad con signals en servicios
Entendiendo la inyección de dependencias
Integración y Datos
Obteniendo datos una REST API
Importaciones cortas en Typescript
Pipes en Angular
Construyendo tu propio pipe
Utilizando librerías de JavaScript en Angular
Conociendo las directivas
Deployando un proyecto en Vercel
Enrutamiento y Navegación
Ruta 404
Uso del RouterLink
Vistas anidadas
Uso del RouterLinkActive
Detalle de cada producto
Obteniendo datos del producto
Galería de imagenes
Detalle de la galería
Perfeccionando tu e-commerce
Mostrando categorias desde la API
Url Params
LazyLoading y Code Splitting
Aplicando LazyLoading
Prefetching
Usando la nueva sintaxis de Angular 17
Lanzando tu aplicación a producción
You don't have access to this class
Keep learning! Join and start boosting your career
In Angular, components are the basis for building robust applications, as if they were Lego pieces that allow you to create large architectures. An Angular component is composed of a template, a CSS and a TypeScript logic file. The communication between the template and the logic is done through property binding and event binding. These allow sending data from the logic to the template and receiving events from the user, such as clicks or key presses, to modify properties of the component.
The versatility of Angular is not limited to using only standard HTML tags; you can develop your own components, with custom properties and events. When starting a large project, it is convenient to organize the application into modules or domains. Each domain can represent different sections of the project, such as products, sales or authentication. You can structure your project in this way:
Once the structure is defined, go to the terminal to start creating the components. Use the command ng generate
or its abbreviation ng g
. For example:
ng generate component domains/products/pages/list.
This command creates a list page within the products domain. For more specific components, e.g. for an individual product:
ng generate component domains/products/components/product
The next step is to modify the routing system so that your application does not depend exclusively on the app component
, but allows the use of pages and components defined in your modular project. For this purpose it is used:
In the routes file, it ensures that the app component
contains the router outlet
to activate the routing logic, and defines the necessary routes as the initial empty route (''
) rendered by the list component
:
const routes: Routes = [ { path: '', component: ListComponent }, // other routes];
For very small templates, Angular offers flexibility. It is not mandatory to create a separate HTML file for each single template. You could simplify by defining the template directly in the component using the template
property instead of templateUrl
. Despite this option, if the template requires complex logic, it is preferable to have it in a separate file. This helps to keep the code clean and easy to manage.
The app.component
can become very light if you choose to remove a dedicated CSS file and any unnecessary HTML files, as long as you contain the necessary logic within the component:
styles.css
file, the app.component's own CSS file can be redundant and removed.With these actions, you reduce complexity and improve the performance of your application as it grows.
Contributions 7
Questions 2
✅
Want to see more contributions, questions and answers from the community?