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 06c4388

Browse files
More questions
1 parent f7dd71f commit 06c4388

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

‎README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,53 @@ PA: Set up angular2-logger, which is a package inspired by log4j.
5757

5858
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.)
5959

60+
61+
## NgModules Questions:
62+
63+
**What is the purpose of NgModule?**
64+
65+
A: to give Angular information on a particular module’s contents, through decorator properties like: declarations, imports, exports, providers, etc.
66+
67+
**How do you decide to create a new NgModule?**
68+
69+
A: Typically for a nontrivial feature in an application, that will involve a collection of related components and services.
70+
71+
**What are the attributes that you can define in an NgModule annotation?**
72+
73+
A: declarations, imports, exports, providers, bootstrap
74+
75+
**What is the difference between a module's forRoot() and forChild() methods and why do you need it?**
76+
77+
A: forRoot and forChild are conventional names for methods that deliver different import values to root and feature modules.
78+
79+
**What would you have in a shared module?**
80+
81+
A: common components, directives, and pipes used in other modules in your application.
82+
83+
**What would you not put shared module?**
84+
85+
A: services that should not have multiple instances created for the application.
86+
87+
**What module would you put a singleton service whose instance will be shared throughout the application (e.g. ExceptionService andLoggerService)?**
88+
89+
A: Root Module
90+
91+
**What is the purpose of exports in an NgModule?**
92+
93+
A: provide components, directives, pipes to other modules for their usage.
94+
95+
**Why is it bad if SharedModule provides a service to a lazy loaded module?**
96+
A: TODO
97+
98+
**Can we import a module twice?**
99+
100+
A: yes, and the latest import will be what is used.
101+
102+
**Can you re-export classes and modules?**
103+
104+
A: Yes (?)
105+
106+
**What kind of classes can you import in an angular module?**
107+
108+
A: Components, pipes, directives
109+

0 commit comments

Comments
(0)

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