Servigistics InService 自訂 > 自訂系統整合 > 新增自訂 JavaScript 檔案
  
新增自訂 JavaScript 檔案
您可以新增其他 Angular 物件庫。因 6.3 發行版本中的 AngularJS 變更,您可能需要執行此操作。如需詳細資訊,請參閱 Servigistics InService 6.3 中的 AngularJS 變更
載入自訂 JavaScript 檔案
欲載入自訂 JavaScript 檔案,請遵循下列步驟:
1. 將檔案放在自訂應用程式目錄中:<WT_HOME>/codebase.war/delivery/custom/app。請確定自訂目錄結構會鏡像遞送目錄。
2. 檔案需要在 customizations.js 中。例如,如果檔案是 delivery/custom/app/modules/myCustomModule.js,請將這一行新增至 customizations.js 的必要部份:"custom/modules/myCustomModule"。請注意 "delivery/custom/app" 會縮短為 "custom"。
3. 最小化用戶端:<ANT_HOME>/bin/ant -f <WT_HOME>/codebase.war/delivery/minimize.xml minimize
您的檔案現在會自動隨應用程式載入。
將相依性新增至 InService Angular 模組
如果您想要使用 InService 現成不支援的 Angular 模組,您需要先確定檔案使用 RequireJS 來要求 AngularJS。像這樣建構檔案:
define(
[
“angular”
],
function (angular) {
angular.module(“myCustomModule”) …..
}
);
當檔案要求 AngularJS 時,請依照下列步驟來將其新增為相依性:
1. 使用上述載入自訂 JavaScript 檔案的步驟載入檔案。
2. customizations.jsbefore 函數中將模組新增為 InService 模組的相依性:module.requires.push('myCustomModule');