You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+60-5Lines changed: 60 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,9 @@
1
-
# 90+ Angular 2+ Interview Questions And Answers
1
+
# 100+ Angular 2, 4 and 5 Interview Questions And Answers
2
2
3
3
This is a collection of Angular 2 interview questions I've found online, along with (hopefully) correct answers for most of them. Feel free to contribute / send corrections.
4
+
I'm adding in some Angular 4 and 5 questions now.
4
5
5
-
Note: "PA" = Possible Answer (one of many valid ones), and "A" = Answer (when there's clearly just one right answer).
6
+
Note: "PA" stands for Possible Answer (one of many valid ones).
6
7
7
8
## Template Syntax Questions
8
9
@@ -14,6 +15,10 @@ A: A variable (defined using a #) in a component template, which can be referenc
14
15
15
16
A: Interpolation binding, one way binding, two way binding.
16
17
18
+
**What's the difference between binding a value with or without square brackets, i.e.: `<input attr="something" />` vs `<input [attr]="something" />`?**
19
+
20
+
A: The square brackets will cause "something" to be evaluated as an expression, as opposed to just be passed in as a literal string.
21
+
17
22
**What does the ngFor template syntax look like?**
18
23
19
24
A: example:`<ul><li *ngFor="let val of values">{{val}}</li></ul>`
@@ -33,7 +38,7 @@ A: A grouping element that does not interfere with styles or layout (it's analog
33
38
34
39
**What is `<ng-template>`?**
35
40
36
-
A: It's an Angular element for rendering HTML when using structural directives. The ng-template itself does not render to anything but a commment directly.
41
+
A: It's an Angular element for rendering HTML when using structural directives. The ng-template itself does not render to anything but a comment directly.
A: By specifying the moduleId to be module.id in the Component decorator. (Note: while this is still needed when using SystemJS, it is not necessary anymore when using Webpack module bundler for Angular 2 projects.)
76
81
82
+
**What are dynamic components?**
83
+
84
+
A: Components that are added at runtime (i.e. not fixed). For example, an ad banner component that is determined at runtime.
85
+
86
+
**What is ComponentFactoryResolver used for?**
87
+
88
+
A: A class that is used to create dynamic components - it produces a ComponentFactory for a particular component which can then be loaded into view via a createComponent on ViewContainerRef.
89
+
77
90
78
91
## NgModules Questions:
79
92
@@ -125,6 +138,14 @@ A: Yes.
125
138
126
139
A: Components, pipes, directives
127
140
141
+
**What is the providers property used for in a module's NgModule metadata?**
142
+
143
+
A: To provide a list of service cerators that this module contributes to the global collection of services.
144
+
145
+
**What is bootstrapping in Angular?**
146
+
147
+
A: The mechanism that launches the application in Angular, loading the root module (typically called AppModule) which loads one or more bootstrapped components into the application's DOM.
148
+
128
149
## Services Questions:
129
150
130
151
**What is the use case of services?**
@@ -192,7 +213,7 @@ A: Stateful, asynchronous
192
213
193
214
**What types of pipes are supported in Angular 2?**
194
215
195
-
A: Pure and impure pipes (async pipes a kind of impure pipe).
216
+
A: Pure and impure pipes (async pipes are a kind of impure pipe).
196
217
197
218
## Routing Questions:
198
219
@@ -314,6 +335,28 @@ A: Verifying some field using some asynchronous call (perhaps a server call)...
314
335
315
336
A: Setting a form value (one or more fields with an object) bypassing validation.
316
337
338
+
## Observables Questions
339
+
340
+
**What are observables?**
341
+
342
+
A: They provide a declarative way of message passing between publishers and subscribers in an application. They typically produce one or more values over time, which are subscribed to by observers. They provide some advantages over promises.
343
+
344
+
**What is RxJS?**
345
+
346
+
A: RxJS stands for Reactive Extensions for JavaScript, and is a reactive programming library centered around observables and operators making it easier to write complex asynchronous code.
347
+
348
+
**How do observables differ from promises?**
349
+
350
+
A: Observables are declarative; promises execute immediately upon creation. Observables can provide many values, whereas promises provide one value. Observables are cancellable, whereas promiess aren't. Error handling also differs between them.
351
+
352
+
**What are some advantages to using observables?**
353
+
354
+
A: Observables are cancellable; they come with powerful transformative functions (especially when using RxJS) to make asynchronous coding easier.
355
+
356
+
**Does an observable compute anything if it has no calls to subscribe?**
357
+
358
+
A: No, it will not.
359
+
317
360
## Animations Questions
318
361
319
362
**How do you define transition between two states?**
**What is Reactive programming and how does it relate to Angular?**
381
+
382
+
A: It's an "asynchronous programming paradigm concerned with data streams and the propagation of change."
383
+
337
384
**What are some differences between Angular 2 and 4?**
338
385
339
-
A: Improvements in AOT; allowing else clause in ngIf, few other things...
386
+
A: Improvements in AOT, allowing the "else" clause in ngIf, support for TypeScript 2.1, breaking out the animations package...
340
387
341
388
**What are some security related features built in to the Angular framework?**
342
389
@@ -366,6 +413,14 @@ A: In the tsconfig.json file.A
366
413
367
414
A: Linting the TypeScript code (making sure it conforms to certain standards / conventions).
368
415
416
+
**What are some changes introduced in Angular 4?**
417
+
418
+
A: Introduction of the else clause in ngIf; splitting out of animation package; support for TypeScript 2.1; improvements around AOT.
419
+
420
+
**What are some changes introduced in Angular 5?**
421
+
422
+
A: New version of HttpClient; build optimizer; Universal State Transfer API (allows sharing state of app between server and client easily); support for TypeScript 2.3.
0 commit comments