Я получаю данные из API и пытаюсь отобразить их в своем приложении angular. Я могу получить и отобразить данные, но они не в хорошем формате.
{
"countryCode": "BS",
"countryName": "BAHAMAS",
"publishedDate": "2020-03-30T00:00:00.000Z",
"alertMessage": "\nAll international flights to Uganda are suspended until 24 April 2020.|\n- This does not apply to:|\n1. Aircraft in a state of emergency.||\n2. Operations related to humanitarian aid, medical and relief flights.||\n3. Technical landings where passengers do not disembark.||\n4. Any other flight that may be so approved by the appropriate authority.||\n"
},
{
"countryCode": "FJ",
"countryName": "FIJI",
"publishedDate": "2020-03-30T00:00:00.000Z",
"alertMessage": "\n1. Passengers and airline crew are not allowed to enter Fiji.|\n- This does not apply to nationals of Fiji.||\n2. Nationals of Fiji must go into quarantine for a period of 14 days.||\n"
}
JSON данные, которые Я получаю из API.
Ожидаемый вывод:
, но вывод, который получается,
мой код следующим образом
<div class="card" style="width: 69rem;" *ngFor="let alert of jsonValue">
<div class="card-body" #{{alert.countryName}}>
<div class="container">
<div class="row">
<div class="col">
<span> <p class="card-title h2" style="float: left">{{alert.countryName}}</p></span>
</div>
<div class="col">
<span><img src="../../../assets/flags/{{alert.countryCode | lowercase}}.svg" style="width: 40px; height: 28px;"></span>
</div>
</div>
</div>
<p class="card-text">{{alert.alertMessage}}</p>
<p class="card-footer" style="float: right">{{alert.publishedDate | date:'short'}}</p>
</div>
</div>