There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.
Close

Processing...
This may take a few seconds.

Component - add/remove

This example is similar in functionality to the component attribute binding example, but it also includes the adding and removing of components to and from the DOM.

The updating of the attributes occur outside of the component, hence we set up an array of values outside the component that get updated rather than inside the component.

If we wanted to change the colors randomly from within the component, we wouldn't use this method of passing attributes. Have a look at the other component examples (events, isolated variables and Tic Tac Toe) to see how components can be controlled from within themselves with isolated events and variables.

Component - add/remove