7

The ngNewRouter (now named ngComponentRouter) was supposed to be in 1.4, but was delayed and is now supposed to go into 1.5 (as I understand it). However, it's not in the 1.5 beta2 package. I do see angular1_router on github, but I don't see that built module included in the 2.0 alpha packages either.

  1. Does anyone know if the new router will actually be in the 1.5 release?
  2. Is there a current build of the new router hosted anywhere? I managed to find a copy of the compiled js from a random plunker, but haven't been able to compile the source myself (issues with node-gyp & msbuild, still working on that).
  3. Does anyone know of any up-to-date documentation or working samples on the new component router? The best site I've found so far is pretty close (it says it was published in February, but it uses ngComponentRouter rather than ngNewRouter so it's clearly being updated), but the post still has things wrong - like it says to create controllers for the components you're loading for the routes, but I discovered that you actually need to be creating them as directives (optimally using the new "component" wrapper in 1.5) with the restrict set to "A" (that was fun to figure out).
4

2 回答 2

4

您可以通过 npm 获取新路由器:

npm install @angular/router

有关当前 API 的更多信息,您可以查看: https ://angular.io/docs/js/latest/api/router/Router-class.html

它适用于 Angular 2,但路由器的核心机制是相同的,它应该为您提供一些关于 API 与 ngNewRouter 相比如何更改的提示。

于 2015-12-06T20:11:02.573 回答
2

看起来组件路由器已经发布。这是官方文档:https ://docs.angularjs.org/guide/component-router

不过,我没有看到任何官方公告说它已经发布,所以我不确定它是否应该是“官方的”。

于 2016-04-18T15:37:21.093 回答