Friday, March 12, 2021

PART-2 INTERVIEW TYPE QUESTIONS (Dependencies DevDependencies, Component , Model, Module, View, Selector... )

1. Differentiate between dependencies and dev dependencies.

DEPENDANCIES

(1) Dependancies are installed on both :

  • npm install from a directory that contains package.json.
  • npm install $package on any other directory.
(2) Dependancies are installed transitively: if A requires B, and B requires C, then C gets installed, otherwise, B could not work, and neither would A.

(3) Dependencies are required to run.

DEVDEPENDANCIES

(1) DevDepandancies  are:
  • also installed on npm install on a directory and also that contains the package.json, unless you pass the --production flag.
  • not installed on npm install "$package" on any other directory, unless you give it the --dev option.
(2) DevDependencies is not installed transitively. E.g. we don't need to test B to test A, so B's testing dependencies can be left out.

(3) devDependencies are required only to develop.

2. Explain view, components, modules and models.

MODELS

The model in an MVC-based application is generally responsible for modeling the data used in the view and handling user interactions such as clicking on buttons, scrolling, or causing other changes in the view.

COMPONENT

Components define views, which are sets of screen elements that Angular can choose among and modify according to your program logic and data.

Components use services, which provide specific functionality not directly related to views. Service providers can be injected into components as dependencies, making your code modular, reusable, and efficient.

MODULES

Every Angular app has a root module, conventionally named AppModule, which provides the bootstrap mechanism that launches the application. An app typically contains many functional modules.

Module conventionally named AppModule and resides in a file named app.module.ts. You launch your app by bootstrapping the root NgModule.

VIEW

View is the layer that displays content to the user . It is also the presentation layer.

3. What is the industry naming convention for Angular file and folder?

Naming conventions are most important thing in the any programming languages like as angular. Some naming conventions in the angular are like as:

  • Do use consistent names for all symbols.
  • Do follow a pattern that describes the symbol's feature then its type. The recommended pattern is feature.type.ts .
  • Separate file names with dots and dashes like , Do use dashes to separate words in the descriptive name, Do use dots to separate the descriptive name from the type.
  • Do use consistent names for all assets named after what they represent.
  • Do use upper camel case for class names.
  • Do match the name of the symbol to the name of the file. etc.
The folder structure of an Angular Project is:



4. How does Angular application bootstrap (start) ?

Following diagram clearly shows that how the Angular application start:




5. What is a decorator?

In Angular JS, decorators are functions that allow a service, directive or filter to be modified prior to its usages. decorators are a design pattern that is used to separate modification or decoration of a class without modifying the original source code.

6. What is a selector?

A selector is one of the properties of the object that we use along with the component configuration. A selector is used to identify each component uniquely into the component tree, and it also defines how the current component is represented in the HTML DOM(Document Object Model).It makes view of  the component possible.

7. Explain the importance of templateURL.


When you have a complex view, then it is recommended by Angular to create that complex view in an external HTML File instead of an inline template. The Angular component decorator provides a property call templateUrl and using this property you can set the external HTML file path.

0 comments:

Post a Comment