请帮我。我必须将 index.html 中“data-smartedit-allow-origin”的硬编码值替换为应该使用站点配置服务检索的值。
通过调用此服务的方法,我可以获得应该用于“data-smartedit-allow-origin”的值。
您对如何将“data-smartedit-allow-origin”硬编码值替换为服务返回的值有任何想法吗?(如果您需要更多信息,请告诉我,我会提供)
索引.html:
<!DOCTYPE html>
<html lang="en">
<head>
...
<script
id="smartedit-injector"
src="webApplicationInjector.js"
data-smartedit-allow-origin="localhost:9002"
></script>
</head>
<body>
...
</body>
</html>
服务:
@Injectable({
providedIn: 'root'
})
export class SiteConfigurationDetailsService {
constructor(
private readonly siteConfigurationService: siteConfigurationService
) {}
public getStringValueForKey(key: string): Observable<string> {
return this.siteConfigurationService.getConfigurationByKey(key).pipe(
map(result => {
return result.value.value;
})
);
}
}