2017-08-01 54 views
0

有沒有人嘗試在SharePoint託管加載項中使用Angular 4?我已經遵循了許多與Angular 2一起工作的例子,但是一旦我嘗試使用Angular 4進行復制,當我發佈加載項時,我會遇到模糊的錯誤。SharePoint插件與Angular 4

例子我用: https://www.youtube.com/watch?v=ZnQy3Hgl7lE https://askmanisha.wordpress.com/2016/08/10/create-basic-sharepoint-add-in-using-angular-2/

我注意到角模塊是爲角4和懷疑可能是問題的一部分,進一步細分,我已經引用不正確的庫或沒有包括一些關鍵的。有沒有人嘗試過這種方式,並使其工作?

+0

你使用的是SP 2016嗎? –

+0

SharePoint在線 – user1783490

回答

0

由於您使用SP Online,您應該使用SPFX和道奇經典的Web部件的設計,同樣也適用於SP 2016年

https://dev.office.com/sharepoint/docs/spfx/sharepoint-framework-overview

一旦你熟悉了SPFX架構,首先需要引導你的網絡的一部分:

yo @microsoft/sharepoint 

然後你從NPM安裝角1.6.5版本:

npm install --save angular 

一旦角安裝,你可以升級到角4:

npm install --save @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] @angular/[email protected] [email protected] 

和進口角到代碼:

import * as angular from 'angular';