@@ -48,7 +48,7 @@ Answer: By using the two-way binding syntax [()] along with ngModel...
4848
4949** How would you create a component to display error messages throughout your application?**
5050
51- A: Set up an ErrorHandler... TODO
51+ A: Implement your own ErrorHandler and configure it in the list of providers for the modules you want it used in.
5252
5353** How would you support logging in your Angular app?**
5454
@@ -93,16 +93,17 @@ A: Root Module
9393
9494A: provide components, directives, pipes to other modules for their usage.
9595
96- ** Why is it bad if SharedModule provides a service to a lazy loaded module?**
97- A: TODO
96+ ** Why is it (potentially) bad if SharedModule provides a service to a lazy loaded module?**
97+ 98+ A: You will have two instances of the service in your application, which is often not what you want.
9899
99100** Can we import a module twice?**
100101
101102A: yes, and the latest import will be what is used.
102103
103104** Can you re-export classes and modules?**
104105
105- A: Yes (?)
106+ A: Yes.
106107
107108** What kind of classes can you import in an angular module?**
108109
@@ -119,6 +120,7 @@ A: One very common use case is providing data to components, often by fetching i
119120A: Via Angular’s DI (Dependency Injection) mechanism
120121
121122** Why is it a bad idea to create a new service in a component like the one below?**
123+ 122124` let service = new DataService(); `
123125
124126A: The object may not be created with its needed dependencies.
@@ -148,7 +150,7 @@ PA: fetch initial component data (e.g. from server).
148150
149151** What would you consider a thing you should be careful doing on onNgInit()?**
150152
151- A: ??
153+ A: You cannot expect the component's children's data-bound properties to have been checked at this point.
152154
153155** What is the difference between onNgInit() and constructor() of a component?**
154156
@@ -207,7 +209,7 @@ A: `<a [routerLink]="[’product.id’]">{{product.id}}</a>`
207209
208210** How would you select a custom component to style it?**
209211
210- A: TODO
212+ A: Using the ` :host ` pseudo-class selector in your component's styles.
211213
212214** How do you reference the host of a component?**
213215
0 commit comments