我正在尝试在离子3中实现Google自定义搜索 . 我尝试了如下 .

searchAPI.js

(function() {
var cx = 'KEY';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();

index.html

<script src="assets/js/searchAPI.js"></script>

voice-search.html

<gcse:search></gcse:search>

这给出了以下错误

':gcse:search'不是已知元素:1 . 如果':gcse:search'是Angular组件,则验证它是否是此模块的一部分 . 2.要允许任何元素将'NO_ERRORS_SCHEMA'添加到此组件的'@NgModule.schemas' . (“[ERROR - >]”):ng:///AppModule/VoiceSearchPage.html@65:6 at syntaxError(http:// localhost:8100 / build / vendor.js:75287:34)在TemplateParser.parse(在JitCompiler._compileTemplate(http:// localhost:8100 / build / vendor.js:108553:23)位于http:// localhost:8100 / build / vendor.js:108455:62 at Set.forEach()at JitCompiler._compileComponents(http:// localhost:8100 /build/vendor.js:108455:19)在http:// localhost:8100 / build / vendor.js:108325:19 at Object.then(http:// localhost:8100 / build / vendor.js:75276: 77)在JitCompiler._compileModuleAndComponents(http:// localhost:8100 / build / vendor.js:108324:26)

应用程序外部的HTML代码工作正常 .

如何解决这个问题? How can I properly implement Google Custom Search in ionic 3?

我在这里尝试语音搜索 . 我将不得不通过语音识别获得搜索查询,然后搜索网络并显示结果 . 在离子3中有没有其他方法可以做到这一点?