如何在新行上打印输出?
How to print output on new line?
case Constants.QUEUEESCALATION:
{
var body = '';
angular.forEach(caseChangeRecord, function(change, key) {
body += change.fieldName + Constants.QUEUEESCALATION_MSG + checkIfDate(change.originalValue) + Constants.TO + checkIfDate(change.newValue) + Constants.FULLSTOP + '\n';
});
return {
objectType: Constants.TYPE_INFO,
objectIcon: 'fa-list-ul',
objectBody: body
};
}
在最后添加 \n 后,它将在新行的同一行显示输出。
实际输出:
assignedQueue 已从 Q1 更改为 Q48。 assignedQueueDate 已从 06/27/2017 更改为 07/03/2017。
需要输出:
assignedQueue 已从 Q1 更改为 Q48。
assignedQueueDate 已从 06/27/2017 更改为 07/03/2017。
在\n
前加一个space。它在我身边工作。
body += change.fieldName + Constants.QUEUEESCALATION_MSG + checkIfDate
(change.originalValue) + Constants.TO + checkIfDate(change.newValue) +
Constants.FULLSTOP + ' \n';
更新:
你的 html 应该像使用 innerHtml
<div class="timeline-body" [innerHTML]="item.body"></div>
将行除以 '\n'
标记并将您的 item.body
包装到 <pre>
:
<div class="timeline-body">
<pre>
{{item.body}}
</pre>
</div>
case Constants.QUEUEESCALATION:
{
var body = '';
angular.forEach(caseChangeRecord, function(change, key) {
body += change.fieldName + Constants.QUEUEESCALATION_MSG + checkIfDate(change.originalValue) + Constants.TO + checkIfDate(change.newValue) + Constants.FULLSTOP + '\n';
});
return {
objectType: Constants.TYPE_INFO,
objectIcon: 'fa-list-ul',
objectBody: body
};
}
在最后添加 \n 后,它将在新行的同一行显示输出。
实际输出:
assignedQueue 已从 Q1 更改为 Q48。 assignedQueueDate 已从 06/27/2017 更改为 07/03/2017。
需要输出:
assignedQueue 已从 Q1 更改为 Q48。
assignedQueueDate 已从 06/27/2017 更改为 07/03/2017。
在\n
前加一个space。它在我身边工作。
body += change.fieldName + Constants.QUEUEESCALATION_MSG + checkIfDate
(change.originalValue) + Constants.TO + checkIfDate(change.newValue) +
Constants.FULLSTOP + ' \n';
更新:
你的 html 应该像使用 innerHtml
<div class="timeline-body" [innerHTML]="item.body"></div>
将行除以 '\n'
标记并将您的 item.body
包装到 <pre>
:
<div class="timeline-body">
<pre>
{{item.body}}
</pre>
</div>