# Tip: change your mental model
When transitioning from an imperative approach, like in vanilla JavaScript or jQuery, to a declarative framework like Angular, it's crucial to adjust your mental model to focus on data binding rather than direct DOM manipulation.
In jQuery, developers are accustomed to explicitly updating the DOM using methods like append
, remove
, or html
to manipulate elements directly. This approach involves a step-by-step process where you tell the browser exactly how to change the DOM, which can lead to verbose and hard-to-maintain code.
In contrast, Angular, and most of recent front-end frameworks, embraces a declarative paradigm where you define the desired state of the UI and let the framework handle the DOM updates.
Here, you bind your HTML templates to your component's data properties using Angular's powerful data binding mechanisms.
For example, instead of manually appending a new item to a list, you simply update the underlying data array, and Angular takes care of rendering the new item.
The following snippet shows how you can display a list of items using a declarative approach in Angular.
Don't worry if you still don't understand how this for
block works. We'll talk about it in next chapters
If you want to add a new element to the list you can simply push a new item to the array and it will be magically updated. That's all :)