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 6536788

Browse files
More questions
1 parent 3b325d6 commit 6536788

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

‎README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,49 @@ PA: use formErrors
277277

278278
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)`).
279279

280+
281+
## Architecture Questions:
282+
283+
**What is a good use case for ngrx/store?**
284+
285+
A: complex application state management requirements, involving asynchronous requests to update state...
286+
287+
**What would be a good use case for having your own routing module?**
288+
289+
A: An application whose requirements imply having many routes, and potentially route guards, and child routes.
290+
291+
## API Questions:
292+
293+
**What does this line do?**
294+
`@HostBinding('[class.valid]') isValid;`
295+
296+
A: Applies the css class ‘valid’ to whatever is using this directive conditionally based on the value of isValid.
297+
298+
**Why would you use renderer methods instead of using native element methods?**
299+
300+
A: Potentially if you’re rendering to something besides the browser, e.g. rendering native elements on a mobile device, or server side rendering (?).
301+
302+
**What is the point of calling renderer.invokeElementMethod(rendererEl, methodName)?**
303+
304+
A: To invoke a method on a particular element but avoid direct DOM access (so we don’t tie our code just to the browser).
305+
306+
**How would you control size of an element on resize of the window in a component?**
307+
308+
A:
309+
`@HostListener('window:resize', ['$event'])
310+
onResize(event: any) {
311+
this.calculateBodyHeight();
312+
}`
313+
314+
**What would be a good use for NgZone service?**
315+
316+
A: Running an asynchronous process outside of Angular (?)
317+
318+
**How would you protect a component being activated through the router?**
319+
320+
A: Route Guards
321+
322+
**How would you insert an embedded view from a prepared TemplateRef?**
323+
324+
PA: `viewContainerRef.createEmbeddedView(templateRef);`
325+

0 commit comments

Comments
(0)

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