Question presented to candidate: "You run ng new on a current Angular version. Walk me through how the app starts: which files are involved, what goes where, and how you would add HTTP, a config file loaded at startup and an existing NgModule library."
What a strong answer should cover:
main.tscallsbootstrapApplication(App, appConfig)from@angular/platform-browser; there is no root NgModule.app.config.tsexports anApplicationConfigwhoseprovidershold app-wide setup:provideRouter(routes),provideHttpClient(...),provideBrowserGlobalErrorListeners().- The root component must be standalone and its selector must match a tag in
index.html. - Startup work goes in
provideAppInitializer(() => ...)(theAPP_INITIALIZERtoken is deprecated); bootstrap waits for a returned Promise. - NgModule-based libraries plug in with
importProvidersFrom(SomeModule). - Typical failures: selector not in the page (NG05104), non-standalone root (NG0907), a rejected initializer (bootstrap rejects, nothing renders).
Clarifying questions expected:
- "Browser only, or does the app also render on the server?"
- "Is this a new project, or an existing NgModule app we are converting?"
Code / implementation expected: Yes β an appConfig with router, a value provider and an async app initializer, and the root component reading what the initializer loaded.