Loading

Quipoin Menu

Learn • Practice • Grow

angular / Angular Libraries
interview

Q1. What are Angular libraries?
Angular libraries are reusable packages that extend Angular''s functionality. They can be published to npm and installed in Angular projects. Libraries can contain modules, components, directives, pipes, and services. Examples include Angular Material, ng-bootstrap, RxJS, and HttpClient. You can also create and publish your own libraries.

Q2. How do you install and use a third-party library in Angular?
Install the library via npm, e.g.,
npm install @angular/material
Then import the necessary modules into your AppModule or feature modules. Some libraries may require adding CSS to angular.json or configuring providers. Always follow the library''s documentation.

Q3. What is Angular Material?
Angular Material is a UI component library that implements Material Design for Angular. It provides ready-to-use components like buttons, cards, dialogs, tables, and form controls. It includes themes, accessibility, and animations. It''s the official component library for Angular and follows Material Design guidelines.

Q4. What is the difference between a library and a module?
A library is a collection of code packaged for distribution, typically containing multiple modules. A module (NgModule) is an Angular construct that organizes related components, directives, pipes, and services. An Angular library may expose one or more NgModules that you can import into your application.

Q5. How do you create your own Angular library?
Use the Angular CLI to generate a library in a workspace:
ng generate library my-lib
This creates a projects/ folder with the library structure. You can develop, build, and test the library independently. To publish, run
ng build my-lib cd dist/my-lib npm publish