IONIC Section 5 - 5.2 Why use Angular ?
Click here for more videos available on our youtube channel !Hello everyone, so in this module we learned a lot about the basic Ionic components, we learned that the official documentation is the ideal place to know everything, all the possible configurations, because it is impossible to memorize them in their entirety, you'll learn them in more detail with practice, so it's only natural for you to review documentation first before starting your design. Now let's see together why use Angular at this time? To be more precise, there are 3 main reasons for which we will use Angular, because doing everything by yourself is all the longer and more complicated, especially if we have more complex logic. We don't want to reinvent the wheel of implementations, we don't want to access the DOM on our own, we just want to control how our DOM should change, data that should be output, such as a list of products. We don't want to worry about logic real output, we only want to control the logic, like add product, validate input products, fetching them from a server is what we want to do. We also do not want to manage the state ourselves, because state management in larger applications can be very difficult, as it allows to pass the data correctly and to update different parts of the application when some data has changed elsewhere. And Angular makes this easier with the help of its services. So to prevent our UI from behaving in such a way unpredictable and our app has a lot of bugs. We absolutely want to use a state management system like the one offered by Angular, its services and dependency injection, which also affects the alert controller and so on. You remember the "ion-alert" component that we placed in our HTML code and then have access via our file JS in order to be able to create it? Well with Angular and Ionic, we can simply inject this alert controller, thanks to the wrapper package that Ionic provides us around the essential components. This then facilitates the use of these components, so that we no longer need to focus on adding and selecting with the query selector but on the fact that we can simply inject it and start using it. Finally, if our application requires several pages because for our example concerning the budget plan, we only have one page, we do not navigate, we do not press the "Back" button to return on a previous page. In much more complete applications, you have different pages, several tabs, several parts of the application differed by a product list, user profile or otherwise. This routing could be done with Ionic, it has its own Routing component, but Angular's Routing is much more powerful, it gives us a lot of advanced features and smart Routing, for correct routing where we can also work with things like query parameters in the URL etc. That's why we use Angular, because it helps us with the complex logic, because we can focus on writing the logic and Angular does the rest of updating the DOM, this gives us clear rules about how to structure your application with components, directives, services. And so on, so that we have a clear plan for building a larger application. He helps us for the services, links and routing to the transport state and tells us about routing. It also helps us with data transfer, painful loading etc… This is why we will use Angular from the next section and I will show you in detail how to set up an Angular and Ionic project. We have had occasion to do this before. I'll give you an appointment in the next video about our next section.