Close #1451: render safe HTML in table output

This commit is contained in:
Arik Fraimovich
2016-12-23 23:07:32 +02:00
parent 7a94bed250
commit a16b333b93
2 changed files with 8 additions and 3 deletions

View File

@@ -10,8 +10,7 @@
</thead>
<tbody>
<tr ng-repeat="row in $ctrl.rows">
<td ng-repeat="column in $ctrl.columns">
{{column.formatFunction(row[column.name])}}
<td ng-repeat="column in $ctrl.columns" ng-bind-html="$ctrl.sanitize(column.formatFunction(row[column.name]))">
</td>
</tr>
</tbody>

View File

@@ -2,7 +2,9 @@ import { sortBy } from 'underscore';
import template from './dynamic-table.html';
import './dynamic-table.css';
function DynamicTable() {
function DynamicTable($sanitize) {
'ngInject';
this.itemsPerPage = this.count = 15;
this.page = 1;
this.rowsCount = 0;
@@ -41,6 +43,10 @@ function DynamicTable() {
}
};
this.sanitize = (value) => {
return $sanitize(value);
}
this.sortIcon = (column) => {
if (column !== this.orderByField) {
return null;