Difference between modules and components in angular.

1.1K    Asked by JohnIngerson in Python , Asked on Jan 10, 2020
Answered by Arun Singh

Components: Components control views (html). They also communicate with other components and services to bring functionality to our app.

A Component contains:

HTML template or HTML code

Code(TypeScript)

Service: It is a reusable code that is shared by the Components so that rewriting of code is not required

Pipe: It takes in data as input and transforms it to the desired output

Modules: Modules consist of one or more components. They do not control any html. The modules declare which components can be used by components belonging to other modules, which classes will be injected by the dependency injector and which component gets bootstrapped. Modules allow us to manage our components to bring modularity to our app. Module is like a big container containing one or many small containers called Component, Service, Pipe



Your Answer

Interviews

Parent Categories