Sharing Top Content from the Angular-sphere.

Overview Of #Angular – Part 1 by @rameshkartikrs cc @CsharpCorner #AngularJS

Overview Of #Angular - Part 1 by @rameshkartikrs cc @CsharpCorner  #AngularJS

  • Module and Component are the essential elements for building an Angular application.
  • Let’s have a quick look at these topics…

    Angular Essentials

    Module

    The module is a mechanism to group components to form an application.

  • In other words, Module is a group of components and services that can be combined with other modules to create an application.
  • The template is none other than an HTML form content which tells Angular how to render the component.
  • Selector tells angular to create an instance of EmployeeComponent and inserts the instance of the component into the tag in parent HTML.

In this article, we are going to discuss an overview of Angular. This article is for those beginners who are planning to learn & implement Angular. Are you an Angular Expert? Then please feel free to provide your suggestions to improve the content. In the first part, we will see what Angular is and why you should give so much importance to it.

@CsharpCorner: Overview Of #Angular – Part 1 by @rameshkartikrs cc @CsharpCorner #AngularJS

In this article, we are going to discuss an overview of Angular. This article is for those beginners who are planning to learn and implement Angular. Are you an Angular Expert?

Then please feel free to provide your suggestions to improve the content. In the first part, we will see what  Angular is, why you should place so much importance on it, and what other things it contains to build a wonderful web application.

Let’s get started!

What is Angular?

Angular is a client side framework which helps to build client side (web) applications using HTML, JavaScript or TypeScript. In other words, we can say that Angular is a binding framework which sits between the HTML UI & JavaScript objects to bind the HTML Views and JavaScript objects. When the user makes a request in HTML UI, the binder(Angular) binds the user input with JavaScript object. When any changes are made in the JavaScript object, the binder (Angular) updates the changes with the HTML UI.

This framework consists of several libraries which help Angular to launch web application content in a browser and respond to user input. Module and Component are the essential elements for building an Angular application. Let’s have a quick look at these topics…

The module is a mechanism to group components to form an application. In other words, Module is a group of components and services that can be combined with other modules to create an application. For Example, look at the below website; you can see that I have highlighted 3 areas which are none other than the modules.These modules are combined together to create an application. Each module, Sales, Visitor or Projects can have one or two components. How many components are under each module? And what are all those components? Let’s discuss this in the next section.

Modules are built using many components. So create as many as components as you need and declare it inside the Module. There are two types of modules in Angular, root modules and feature modules.Angular needs to know which one is root module and which one is a feature module. I am not going to detail it here, probably in my next article I will provide you with a source code example.

The component is a class which works with a view of the application and logic on the page. The component has the required information of how to render itself and fetches the required data from services. So Component mainly works with UI or views to render the page. Components are typically grouped under a module. As we do in C#, Java we can also trigger a property which returns an array of objects that it requires from the service. Basically, a component is something which is visible to the end user and which can be reused many times within the web application. Look at the below Website, a visitor module has 2 components named UserActivity & Returned users. Component 1 is mainly responsible for displaying the UserActivity(Component 1) UI content, whereas Component 2 is responsible for displaying the ReturnedUsers(Component 2) UI content. Likewise you can check the modules like Sales, Projects also have their own components SalesListWise, SalesMapWise and ProjectsListWise. If you want to utilize the components in other modules, you can reuse it.

Let’s discuss this in detail in the next section.

The template is none other than an HTML form content which tells Angular how to render the component. I have already mentioned that Component is something that works with UI/view. The component deals with UI by using a template which helps angular to render the page. The template also includes binding and directives.

Metadata – Data about data.

Metadata is a decorator which provides extra information about the class to Angular. What is that information? What will Angular do with that information?

Let’s have a look on this source-code.

@Component is a decorator which is used to create the EmployeeComponent and its view. Selector tells angular to create an instance of EmployeeComponent and inserts the instance of the component into the tag in parent HTML. If the application contains tag anywhere, Angular inserts the instance of the EmployeeComponent between those tags. TemplateURL or template tells Angular how to display the component. In other words, templateUrl contains the address of the component’s HTML template. It is important to add metadata ( @Component ) in your source-code, otherwise angular will treat it as a class, not as a component. @Component metadata tells angular that EmployeeComponent is a Component.

Overview Of Angular