使用Angular 2在SharePoint SPFx中无法正常工作 [英] Routing not working in SharePoint SPFx with Angular 2
问题描述
大家好,
我尝试过实施 路由概念 在客户端web部分使用 SPFx
和Angular 2 。我使用了2个组件进行路由:列出组件(路由路径:""")和详细信息组件(路由路径:"details /:id")。在加载时,我能够从"清单组件"中呈现所有项目。点击
列表项的标题,我正在尝试实现路由概念。 sharepoint
site的URL变为"site-url.aspx / details / 1",如果该项目的ID是1和"详细信息"是详细信息组件的路由路径,但页面未呈现。我在工作台上尝试了Web部件以及
如果有人知道这个问题的解决方案,请帮忙。期待快速回复。
问候,Shreyash
我建议你检查UI路由器(因为ngRoute 会改变其他网页部分的状态页面 )由Waldek在下面建议。
https://blog.mastykarz .nl / build-multi-page-sharepoint-framework-client-side-web-parts-angular /
您可以从github下载示例演示。
https://github.com/SharePoint/ sp-dev-fx-webparts / tree / master / samples / angular-multipage
最好的问候,
利跨度>
Hi All,
I have tried implementing routing concept in the client-side web part using SPFx and Angular 2. I have used 2 components for routing: listing component(routing path: "") and details component(routing path: "details/:id"). On load I am able to render all the items from the "Listing Component. On click of the title of a list item, i am trying to implement the routing concept. The URL of the sharepoint site gets changed to "site-url.aspx/details/1", if the id of the item is 1 and "details" is the routing path of the details component but the page is not getting rendered. I have tried the web part in workbench as well as
If anyone knows a solution to this problem, please help. Expecting a quick reply.
Regards, Shreyash
Hi,
I would suggest you check UI Router(as ngRoute would change the state in other web parts on the page ) suggested by Waldek below.
https://blog.mastykarz.nl/build-multi-page-sharepoint-framework-client-side-web-parts-angular/
You could download the sample demo from github.
https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/angular-multipage
Best Regards,
Lee
这篇关于使用Angular 2在SharePoint SPFx中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!