{"action":"created","issue":{"url":"https://api.github.com/repos/kittencup/angular2-ama-cn/issues/107","repository_url":"https://api.github.com/repos/kittencup/angular2-ama-cn","labels_url":"https://api.github.com/repos/kittencup/angular2-ama-cn/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/kittencup/angular2-ama-cn/issues/107/comments","events_url":"https://api.github.com/repos/kittencup/angular2-ama-cn/issues/107/events","html_url":"https://github.com/kittencup/angular2-ama-cn/issues/107","id":138049576,"number":107,"title":"如何学习Angular 2","user":{"login":"hellokimi","id":16847474,"avatar_url":"https://avatars.githubusercontent.com/u/16847474?v=3","gravatar_id":"","url":"https://api.github.com/users/hellokimi","html_url":"https://github.com/hellokimi","followers_url":"https://api.github.com/users/hellokimi/followers","following_url":"https://api.github.com/users/hellokimi/following{/other_user}","gists_url":"https://api.github.com/users/hellokimi/gists{/gist_id}","starred_url":"https://api.github.com/users/hellokimi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellokimi/subscriptions","organizations_url":"https://api.github.com/users/hellokimi/orgs","repos_url":"https://api.github.com/users/hellokimi/repos","events_url":"https://api.github.com/users/hellokimi/events{/privacy}","received_events_url":"https://api.github.com/users/hellokimi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-03T01:49:23Z","updated_at":"2016-03-03T02:40:55Z","closed_at":null,"body":"如题。"},"comment":{"url":"https://api.github.com/repos/kittencup/angular2-ama-cn/issues/comments/191550130","html_url":"https://github.com/kittencup/angular2-ama-cn/issues/107#issuecomment-191550130","issue_url":"https://api.github.com/repos/kittencup/angular2-ama-cn/issues/107","id":191550130,"user":{"login":"kittencup","id":2220385,"avatar_url":"https://avatars.githubusercontent.com/u/2220385?v=3","gravatar_id":"","url":"https://api.github.com/users/kittencup","html_url":"https://github.com/kittencup","followers_url":"https://api.github.com/users/kittencup/followers","following_url":"https://api.github.com/users/kittencup/following{/other_user}","gists_url":"https://api.github.com/users/kittencup/gists{/gist_id}","starred_url":"https://api.github.com/users/kittencup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kittencup/subscriptions","organizations_url":"https://api.github.com/users/kittencup/orgs","repos_url":"https://api.github.com/users/kittencup/repos","events_url":"https://api.github.com/users/kittencup/events{/privacy}","received_events_url":"https://api.github.com/users/kittencup/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T02:40:55Z","updated_at":"2016-03-03T02:40:55Z","body":"#### 好吧，我来说下我是如何从0开始学angular 2的\r\n\r\n我是在angular2.0.0-alpha.30 开始学习的，网上几乎没有任何资料，所以起步花了很多时间，当然个人认为学习一样新东西，特别是还未发布正式版，不用太急，慢慢学习，慢慢累积。\r\n\r\n##### 了解Angular 2 概念，思想 & 整合资料\r\n\r\n我的\b第一步并不是去学习angular 2怎么写，文档基本没有，而且核心语法没有稳定，太多新概念也不知道什么意思，所以我的第一步是整合资料\r\n\r\n从5个地方入手资料\r\n\r\n* youtube 订阅这些频道，晚上睡前床上看看\r\n ![image](https://cloud.githubusercontent.com/assets/2220385/13482379/d027c7a0-e127-11e5-8912-686a0a41e5ec.png)\r\n\r\n* blog 通过rss订阅，每天早上起来翻一翻，当然现在好的内容，我直接在 angular2-ama-cn 提供了中文翻译\r\n![image](https://cloud.githubusercontent.com/assets/2220385/13482406/ee597b92-e127-11e5-9fa8-926c4e082781.png)\r\n\r\n* twitter 通过blog或angular2的github 获得开发者的twitter\r\n![image](https://cloud.githubusercontent.com/assets/2220385/13482467/705e93b6-e128-11e5-970e-3d0a203c78cc.png)\r\n\r\n* angular 2 官方issue\r\nhttps://github.com/angular/angular/issues\r\n\r\n* angular 2 开发文档 \r\nhttps://drive.google.com/folderview?id=0B7Ovm8bUYiUDR29iSkEyMk5pVUk\r\n\r\n\r\n#### 撸点简单的代码\r\n\r\n我已经掌握es6和ts,也精通angularjs，在看了上面的资料后，已经对angular2有一定了解了，接下去就开始写代码了，碰到的第一个问题就是\b编译环境怎么构建，还好有gulp+webpack基础，也没碰到什么大问题，在这里我一直强调，如果你对gulp webpack ts等编译环境不是很熟悉，建议直接使用github上现成的工具，如https://github.com/AngularClass/angular2-webpack-starter\u0002，先把angular2学会，在去考虑你的项目应该如何去更好的构建\r\n\r\n#### 开群 & 开angular2-ama-cn\r\n\r\n自己能碰到和想到的问题是很有限的，最好的方法就是开个群，研究及解决别人的问题，所以开了个QQ群：263752194，但是又发现，一直有人重复提问，所以又开了个github项目 https://github.com/kittencup/angular2-ama-cn ，来解决重复解答的问题。\r\n\r\n#### 深入研究\r\n\r\n现在会写点代码了，但是并不懂原理，为什么angular2会自动变化检测，angular2的依赖注入怎么实现的，依赖缓存，依赖分层怎么实现的，整个angular2的启动流程是什么？所以只有看源码才能解决这些问题，因为源码里没有秘密。\r\n\r\nangular2的源码是非常复杂的全部看完是相当不易，刚开始我直接看从`bootstrap()`函数开始看，发现根本看不下去，到处都是依赖注入，所以我先把di模块看完，理解了di的实现原理(注册，获取，数据缓存等)，接下去整个angular2是运行在Zone.js上的，这鬼东西资料根本没，好吧去把zone.js的源码看完了，才理解是什么东西，接下去就是从bootstrap开始慢慢撸，从创建zone-> 分析metadata -> componentLoader -> compile ->  viewManage -> changeDetection ，中间的大部分过程都是基于promise处理的，所以你会看到很多promise，看到将template转为ast等,看到如何生成jit的changeDetection, 都是需要花精力去慢慢看的。\r\n\r\n\r\n#### 最后\r\n\r\n当你理解了源码，我觉得你对于整个angular 2框架来说，没有什么解决不了的。恭喜你，可以考虑怎么构建复杂的项目了。\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"}}