but found \<input>. Simplemente quiten las etiquetas \
Espero que les sirva.
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
To work properly with components in Angular, it is necessary to follow certain steps to mount and configure each part. Below, we illustrate with an example how a component can be used in our application through the process of importing and configuring it on a page.
Initially, it is important to structure the HTML of the page where you want to assemble the component. Here we create some paragraphs to give structure and separate elements visually:
<p>Paragraph1</p><p>Paragraph2</p><p>Paragraph3</p><p>Paragraph3</p>
Once the basic elements are ready, we proceed to integrate the desired component. Using the component selector, we can add it directly to the HTML:
<app-counter></app-counter>.
It is vital to make sure that the component is correctly imported. In Angular, one component must be known in the context of the other. This is done by importing the component into the module that will use it.
import { CounterComponent } from 'shared/components/counter.component';
Add it to the imports
array of your module:
@NgModule({ imports: [ CounterComponent ],. ..})
The use of signals is crucial to handle dynamic data and monitor changes in the application in a reactive way.
First, initialize the signals needed for critical variables such as duration
and message
.
const durationSignal = signal(1000);const messageSignal = signal('Default message');
With the signals created, methods are implemented to modify these signals using events, commonly through HTML inputs.
function changeDuration(event: Event) { const inputElement = event.target as HTMLInputElement; durationSignal.set(Number(inputElement.value));}
function changeMessage(event: Event) { const inputElement = event.target as HTMLInputElement; messageSignal.set(inputElement.value);}
These inputs connect to the signals and allow the user to interact and modify values:
<input type="number" [value]="durationSignal" (input)="changeDuration($event)"><input type="text" [value]="messageSignal" (input)="changeMessage($event)"> <input type="text" [value]="messageSignal" (input)="changeMessage($event)">
Once everything is configured, visualize your component and its interactions in practice.
If the about
page is the one where the app-counter
component is displayed, make sure to render the new page properly:
// In the router moduleconst routes: Routes = [ { path: 'about', component: AboutComponent },. ..];
After correctly configuring the page and components, observe the interaction from the browser. Use tools such as DevTools to debug each event in the lifecycle:
ngOnChanges
event is triggered whenever an input property changes.Careful implementation of these steps allows for a rich and interactive experience in Angular applications, facilitating future development and component enhancements. Continue exploring and honing your Angular skills!
Contributions 5
Questions 0
but found \<input>. Simplemente quiten las etiquetas \
Espero que les sirva.
✅
Want to see more contributions, questions and answers from the community?