Just over the course of the past year, Angular has undergone a lot of changes. Read on to get a quick overview of the way this framework works.
Join the DZone community and get the full member experience.Join For Free
Access over 20 APIs and mobile SDKs, up to 250k transactions free with no credit card required
On day six of the advent calendar, I'm going to share some content from Chapter 3 of my book "Front-end Development with ASP.NET Core, Angular, and Bootstrap," which is all about Angular (v5). Specifically, I'm going to introduce the concepts that make the foundation of Angular.
AngularJS vs Angular
I started writing this book in Summer 2015 with the hope of releasing it in Spring 2016 when the then ASP.NET 5 (and ASP.NET MVC 6) was released. But unfortunately, as most people know, ASP.NET
Core had a long history full of fundamental changes that delayed the release of a complete working version, with both the library and matching tooling until Summer 2017.
This also had a lot of consequences on chapter 3 of my book about Angular: I started writing about AngularJS 1.5, but during the two years wait for ASP.NET Core to be done, the vNext of Angular went from Alpha to Beta to release of Angular 2, and later even to the releases of v4 and v5. So chapter 3 went through one complete rewrite and a few smaller ones.
The following is an extract of Chapter 3 about Angular, introducing the foundations of the framework.
Angular is a web application framework developed and maintained by Google and the open-source community. The framework has many features, like two-way data-binding, templating, routing, components, dependency injection, and so on. Unfortunately, like all frameworks of its breed, it has a pretty steep learning curve due to the many concepts you have to grasp in order to be fluent in it. Here is a list of the most important Angular concepts:
- Modules: Containers that group together blocks of functionalities that belong together, like components, directives, services, and so on.
- Components: Define the behavior of a "portion" of the screen.
- Templates: HTML files that define how the view for a component is rendered.
- Data binding: The process that connects a component to its template and allows data and events to flow between them.
- Directives: Custom attributes that enhance HTML syntax and are used to attach behaviors to specific elements on the page.
- Services: Reusable functionalities that are independent of the views.
- Dependency injection: A way to supply dependencies (services most of the time) to classes (other services or components).
- Metadata: Instructs Angular on how to process a class, whether it's a component, a module, a directive, which services have to be injected, and so on.
Those terms might sound abstract at the moment, but... all of these concepts are used to build a... single-page application.
Published at DZone with permission of Simone Chiaretta , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.