Angular 7: внешние сценарии в компоненте - PullRequest
0 голосов
/ 15 января 2020

Я хотел бы встроить этот код в мое приложение angular 7.

<link rel="stylesheet" type="text/css" href="https://cdn2.hubspot.net/hubfs/1716276/embeddable_assessments/disc/disc_assessment_v1.1.0.css" /> 
<script src="https://cdn2.hubspot.net/hubfs/1716276/embeddable_assessments/disc/disc_assessment_v1.1.0.js"></script>
<div id="disc_assessment_root" data-api-token="token-here"></div>
<script>
    window.crystalKnowsDISCResponse = function (response) {
        console.log('Here is the personality JSON response:', response)
    }
</script>

Поэтому ссылка и скрипт должны оставаться в индексе. html, но я должен использовать <div id="disc_assessment_root" data-api-token="token-here"></div> в моем пользовательском компоненте и

window.crystalKnowsDISCResponse = function (response) {
   console.log('Here is the personality JSON response:', response)
}

, чтобы получить результаты, которые возвращает API.

...