Angular Interview question series part 1

Here we talk about the basic interview question which may be asked during your interview like

1) What is DOM (Document’s Object Model)?

Your HTML code is loaded in the browser, in which, at the top level we have Browsers. If we want to use textbox then you need to write a document.getelementbyID. so when we change our textbox, our UI changed or manipulated. The DOME is nothing but a memory in-memory representation of your HTML document.

2) What is AOT (Ahead of time compilation)?

When our all the angular code wants to run into the browser, it tries to compile in pure JavaScript. Even the HTML or also converted into JavaScript. For example, textbox is converted into document.create_element something like that.

In short angular Run into the browser, everything is pure JavaScript.

IV compiler is an extended version of AOT.

When you run NG build, it to create everything into JavaScript way.

3) Explain the folder structure in angular?

E2E: – End to end testing. It is related to unit testing like Jasmine and Karma file.

Node_Module: -Whatever we mention in package the JSON files that things is installed into the folder(Node_Module).

Src: -Our code

4) Can you please explain the basic file of the app folder?

Your model class and your HTML page connected using the component.

It is a code-behind in our application.

In our application, we have several components, so the group of component is termed as a module.

Student.ts: – File will work as our model.
app.component.ts:- File will work as a component.
app.component.HTML:- File works as a view
app.module.ts:- Here all the grouping is performed.

5) What is an asset folder?

An asset folder specifically works for GitHub, whatever the files you are interested in place inside your GitHub directory, all the management is performed here.

6) What is main.ts file?

Question number 4, we have discussed the modules. Our application contains so many modules, so, at run time which module, you want to keep as a starting model, that things are specified inside the main.ts file.

7) Can we run individual modules, like the product modules from your application?

No, we cannot run an individual module, at the runtime, using the NG serve or NG build, everything is gets converted into JavaScript.

Angular uses a web-pack, it is used for the bundling, our main.ts file has an import statement while, app.component.ts file has an export statement, so at the run time, based on import and export, web-pack will bundle all the files and create single “.js”  file.

8)What is the component?

The component is the heart of angular. It is just a simple class if we do not specify the decorator.

  providedIn: 'root'
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']

The decorator specifies that the particular component is connected to which UI using the template URL. Also inside the class, we write our logical coding, and bind with it our view.

Leave a Comment