Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cb39ad7

Browse files
author
Jeff Sanchez
committed
additional questions
1 parent 8ababa2 commit cb39ad7

File tree

1 file changed

+100
-12
lines changed

1 file changed

+100
-12
lines changed

‎README.md

Lines changed: 100 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ This is a collection of Angular 2 interview questions I've found online, along w
44

55
Note: "PA" === Possible Answer (one of many valid ones), and "A" === Answer.
66

7-
## Animations Questions
8-
9-
**How do you define transition between two states?**
10-
11-
PA: Using the transition and animate function in an animations block like so: `animations: [transition('inactive => active'), animate('100 ms ease-in')]`
12-
13-
**How do you define a wildcare state?**
14-
15-
A: Using the asterisk - example: `transition('* => active'), animate('100ms ease-in'))`
16-
177
## Template Syntax Questions
188

199
**What is a template reference variable, and how would you use it?**
@@ -24,6 +14,18 @@ A: A variable (defined using a #) in a component template, which can be referenc
2414

2515
A: Interpolation binding, one way binding, two way binding.
2616

17+
**What does the ngFor template syntax look like?**
18+
19+
A: example:`<ul><li *ngFor="let val of values">{{val}}</li></ul>`
20+
21+
**What does the pipe syntax look like in Angular templates?**
22+
23+
A: example: `<div>{{ value | my-pipe : option }}</div>`
24+
25+
**What does an interpolated string look like in a template?**
26+
27+
A: example: `<div title="Hello {{username}}">...</div>`
28+
2729
## Component/Directive Questions
2830

2931
**What is the minimum definition of a component?**
@@ -54,6 +56,10 @@ A: Implement your own ErrorHandler and configure it in the list of providers for
5456

5557
PA: One way would be to use angular2-logger, which is a package inspired by log4j.
5658

59+
**How would you use the ngClass directive?**
60+
61+
A: For example: `<div [ngClass]="{firstCondition: 'class1', secondCondition: 'class2'}">...</div>`
62+
5763
**How do you resolve a template URL relative to a Component class?**
5864

5965
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.)
@@ -205,6 +211,16 @@ A: Can provide a final wildcard path like so: { path: ‘**’, component: PageN
205211

206212
A: `<a [routerLink]="[’product.id’]">{{product.id}}</a>`
207213

214+
215+
**What do route guards return?**
216+
217+
A: boolean or a Promise/Observable resolving to boolean value.
218+
219+
**What is <router-outlet> for?**
220+
221+
A: Place where routes are mounted in the app??
222+
223+
208224
## Styling Questions:
209225

210226
**How would you select a custom component to style it?**
@@ -280,7 +296,41 @@ PA: Use formErrors
280296
A: Verifying some field using some asynchronous call (perhaps a server call)... return a `Promise<ValidationResult>` from your validator. When creating a FormControl object, you can pass an asynchronous validator into the constructor (e.g. `new FormControl(‘value’, syncValidator, asyncValidator)`).
281297

282298

283-
## Architecture Questions:
299+
**What is patchValue used for?**
300+
301+
A: Setting a form value (one or more fields with an object) bypassing validation.
302+
303+
## Animations Questions
304+
305+
**How do you define transition between two states?**
306+
307+
PA: Using the transition and animate function in an animations block like so: `animations: [transition('inactive => active'), animate('100 ms ease-in')]`
308+
309+
**How do you define a wildcare state?**
310+
311+
A: Using the asterisk - example: `transition('* => active'), animate('100ms ease-in'))`
312+
313+
## Architecture / Framework Questions:
314+
315+
**What are some of the top level building blocks of the Angular framework?**
316+
317+
A: Services, Templates, Modules, Components, Providers, etc.
318+
319+
**What is AOT?**
320+
321+
A: Ahead of time compilation.
322+
323+
**What are some differences between Angular 2 and 4?**
324+
325+
A: Improvements in AOT; allowing else clause in ngIf, few other things...
326+
327+
**What are some security related features built in to the Angular framework?**
328+
329+
A: Sanitation, to prevent cross site scripting. Built-in support in the HttpClient to prevent cross-site request forgery.
330+
331+
**How can you bypass sanitation in Angular and why would you do so?**
332+
333+
A: To inject known safe code, you can bypass sanitation (e.g. to embed an iframe).
284334

285335
**What is a good use case for ngrx/store?**
286336

@@ -290,6 +340,14 @@ A: Complex application state management requirements, involving asynchronous req
290340

291341
A: An application whose requirements imply having many routes, and potentially route guards, and child routes.
292342

343+
**Where would you configure TypeScript specific compiler options for your project?**
344+
345+
A: In the tsconfig.json file.A
346+
347+
**What is the tslint.json file used for?**
348+
349+
A: Linting the TypeScript code (making sure it conforms to certain standards / conventions).
350+
293351
## API Questions:
294352

295353
**What does this line do?**
@@ -323,5 +381,35 @@ A: Route Guards
323381

324382
**How would you insert an embedded view from a prepared TemplateRef?**
325383

326-
PA: `viewContainerRef.createEmbeddedView(templateRef);`
384+
PA: `viewContainerRef.createEmbeddedView(templateRef);
385+
386+
## Testing Questions
387+
388+
389+
**What is Protractor?**
390+
391+
A: E2E (end-to-end) testing framework.
392+
393+
**What is Karma?**
394+
395+
A: Unit test testing library.
396+
397+
**What are spec files?**
398+
399+
A: Jasmine unit test files.
400+
401+
**What is TestBed?**
402+
403+
A: Class to create testable component fixtures.
404+
405+
**What does detectChanges to in Angular jasmine tests?**
406+
407+
A: propagates changes to the DOM by running Angular change detection.
408+
409+
**Why would you use a spy in a test?**
410+
411+
A: To verify a particular value was returned or a method was called, for example when calling a service.
412+
413+
414+
`
327415

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /