What is purpose of using forRoot in NgModule?

前端 未结 4 1411
花落未央
花落未央 2021-01-31 14:11

What is the purpose of using forRoot in NgModule?

Is it same as the providers in AngularJS 1.x?

How does it play the significant role in lazy loading?

TI

4条回答
  •  庸人自扰
    2021-01-31 14:51

    From the docs

    forRoot creates a module that contains all the directives, the given routes, and the router service itself.

    You can read more on why is it used from here

提交回复
热议问题