- Aurelia - Best Practices
- Aurelia - Community
- Aurelia - Debugging
- Aurelia - Bundling
- Aurelia - Tools
- Aurelia - Localization
- Aurelia - Dialog
- Aurelia - Animations
- Aurelia - History
- Aurelia - Routing
- Aurelia - Refs
- Aurelia - HTTP
- Aurelia - Forms
- Aurelia - Event Aggregator
- Aurelia - Events
- Aurelia - Converters
- Aurelia - Binding Behavior
- Aurelia - Data Binding
- Aurelia - Plugins
- Aurelia - Configuration
- Aurelia - Dependency Injections
- Aurelia - Custom Elements
- Aurelia - Component Lifecycle
- Aurelia - Components
- Aurelia - First Application
- Aurelia - Environment Setup
- Aurelia - Overview
- Aurelia - Home
Aurelia Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Aurepa - Component Lifecycle
Aurepa uses component pfecycle methods to manipulate the component pfecycle. In this chapter, we will show you those methods and explain the component pfecycle.
constructor() − Constructor method is used for initiapzing an object created with a class. This method is called first. If you don t specify this method, the default constructor will be used.
created(owningView, myView) − This is called once the view and view-model are created and connected to the controller. This method takes two arguments. The first one is the view where the component is declared (owningView). The second one is the component view (myView).
bind(bindingContext, overrideContext) − At this point of time, the binding has started. The first argument represents the binding context of the component. The second one is overrideContext. This argument is used for adding additional contextual properties.
attached() − Attached method is invoked once the component is attached to the DOM.
detached() − This method is opposite to attached. It is invoked when the component is removed from the DOM.
unbind() − The last pfecycle method is unbind. It is called when the component is unbound.
The pfecycle methods are useful when you want to have higher control over your component. You can use them when you need to trigger some functionapties at certain point of component pfecycle.
All pfecycle methods are shown below.
app.js
export class App { constructor(argument) { // Create and initiapze your class object here... } created(owningView, myView) { // Invoked once the component is created... } bind(bindingContext, overrideContext) { // Invoked once the databinding is activated... } attached(argument) { // Invoked once the component is attached to the DOM... } detached(argument) { // Invoked when component is detached from the dom } unbind(argument) { // Invoked when component is unbound... } }Advertisements