Composant
Un composant est un block de code réutilisable et autonome.
Component = Template (inline/externe) + Style (inline/externe) + Controller(Logique - fichier .ts
)
- Component Decorator :
@Component
- selector
- style
- controller
- Interpolation
- Template variable
ex: display value of an input.
- Event binding
- click ex: increment, decrement.
- input ex: display value of an input
-
Attribute binding
- class
ex: change the
class
when user clicked on a button (error, warning, sucess) - attr ex: hide/display password
- class
ex: change the
- Parent-Child components
- Générer un composant en utilisant le CLI
- Utiliser un composant à l’intérieur d’un autre