1

如何在 Angular 4/5中使用Google Transliterate API ?请检查下面提到的代码。

google.load("elements", "1", {
      packages: "transliteration"
});
function onLoad() {
  var options = {
      sourceLanguage:
          google.elements.transliteration.LanguageCode.ENGLISH,
      destinationLanguage:
          [google.elements.transliteration.LanguageCode.TAMIL],
      shortcutKey: 'ctrl+g',
      transliterationEnabled: true
  };
  var control =
      new google.elements.transliteration.TransliterationControl(options);
  var elements = document.getElementsByClassName('getCountry');
  control.makeTransliteratable(elements);
}
google.setOnLoadCallback(onLoad);

目前,我在 index.html 页面中使用这些代码,但我想在每个组件中以 4/5 角度作为模块导入。

4

0 回答 0