zoukankan      html  css  js  c++  java
  • Angular之RouterModule的forRoot与forChild

    Angular 提供了一种方式来把服务提供商从模块中分离出来,以便模块既可以带着 providers 被根模块导入,也可以不带 providers 被子模块导入。

    区别:

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

    `forChild` creates a module that contains all the directives and the given routes, but does not include the router service.

    RouterModule的元数据

    @NgModule({
        declarations: ROUTER_DIRECTIVES, 
        exports: ROUTER_DIRECTIVES
    })

    RouterModule定义的指令

    const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive];

     

     

  • 相关阅读:
    c#的Marshal
    爬虫之requests详解
    爬取抖音视频
    爬取拉钩网
    爬虫自动登陆GitHub
    爬取博客园博客
    爬取煎蛋网文章
    爬取抽屉热搜榜文章
    准备
    爬虫示例
  • 原文地址:https://www.cnblogs.com/sea-breeze/p/9106434.html
Copyright © 2011-2022 走看看