So How to do lazy loading for router in Angular 2.

The nomarl way to write a router in Angular 2:

You have SimpleCmp and UserCmp as child components. You also import {SimpleCmp, UserCmp} from 'xxxxxx'.

It will not be lazy loaded. Because you already have the reference to the child component.

But it turn out to be very easy to enable the lazy loading:

Just add '' to SimpleCmp and UserCmp.

Then you need to follow the convention of how to name the folder.

The '+' symbol means those folders are lazy loaded. So Component is called UserCmp, the folder should be named as 'user-cmp'. OKOK, not tooo bad.

[Angular 2] Keynote: Lazy Routing -- NGCONF的更多相关文章

  1. Angular基础(七) HTTP & Routing

    ​ 一.HTTP a)Angular提供了自己的HTTP库来调用外部API,为了能够在等待API响应的过程中继续与界面交互,采用异步HTTP请求的方式. b)Get请求,首先导入Http, Respo ...

  2. Angular记录(8)

    文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...

  3. [译]用AngularJS构建大型ASP.NET单页应用(一)

    原文地址:http://www.codeproject.com/Articles/808213/Developing-a-Large-Scale-Application-with-a-Single 渣 ...

  4. angular2-aot-webpack 生产环境下编译angular2

    这里讲讲,angular2在生产模式下用webpack2进行打包的方法: //使用rollup打包还是比较坑的,功能及插件上都不如webpack, 关键不支持代码分离,导致angular里的lazy ...

  5. AngularJS with MVC4 CRUD

    CRUD using MVC Web API and AngularJS In this article I am going to demonstrate about how can we crea ...

  6. Angular45

    Angular 4 Tutorial for Beginners: Learn Angular 4 from Scratch https://www.youtube.com/watch?v=k5E2A ...

  7. [Angular2 Router] Lazy Load Angular 2 Modules with the Router

    Angular 2 lazy loading is a core feature of Angular 2. Lazy loading allows your application to start ...

  8. [AngularJS] Lazy loading Angular modules with ocLazyLoad

    With the ocLazyLoad you can load AngularJS modules on demand. This is very handy for runtime loading ...

  9. 关于Angular.js Routing 的学习笔记(实现单页应用)

    最近开始学习angular.js,发现angular.js确实很方便,也很强大.在看到 AngularJS Routing and Multiple Views 这一部分的时候,有点乱.现在通过记录一 ...

随机推荐

  1. 关于【键鼠<局域网>共享软件:synergy】install

    Installation 另外,本人在centos6.5环境下作为server运行时,遇到一个问题,synergy1.5随着系统升级居然变成了1.3X,所以如果遇到类似问题,请您先用 rpm -qa ...

  2. mysql申请账户

    INSERT INTO mysql.user set Host='%',user='alipay',password=password('alipay'),Select_priv='Y',Insert ...

  3. Xcode-01ARC / Block

    1.nonatomic 2.assign 3.strong 4.weak 5.instancetype 6.@class @property 使部分类在编译时不使用ARC -(可以让这们支持 reta ...

  4. linq 多个left join 和 sql union all -> linq union 方法

     (   from s in Base_SysMenus   join r in Base_RoleRights on s.Menu_Id equals r.Menu_Id into temp   f ...

  5. C# Http POST get

    using System.IO;using System.Net; /// <summary>        /// HttpWebRequest发送Post请求     /// < ...

  6. 7 Tools for Data Visualization in R, Python, and Julia

    7 Tools for Data Visualization in R, Python, and Julia Last week, some examples of creating visualiz ...

  7. javascript for

    var k = ["a", "b", "c", false]; for(var i = 0, m; m = k[i]; i++) { con ...

  8. utf8_to_utf16

    17down voteaccepted Here's some code. Only lightly tested and there's probably a few improvements. C ...

  9. java学习面向对象之抽象类

    什么是抽象类,之所以说抽象就是具体的反义词喽~抽象离我们最近的距离也就是初中的时候学过的美术课,抽象画派.拿一桶画彩就这么往画布上一泼,那就是抽象.那么java世界当中什么是抽象呢?我们再拿动物还有狗 ...

  10. BZOJ1609: [Usaco2008 Feb]Eating Together麻烦的聚餐

    1609: [Usaco2008 Feb]Eating Together麻烦的聚餐 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 938  Solved ...