mirror of
https://github.com/getredash/redash.git
synced 2026-03-23 04:00:09 -04:00
26 lines
673 B
JavaScript
26 lines
673 B
JavaScript
import { isFunction } from 'underscore';
|
|
|
|
export default function init(ngModule) {
|
|
ngModule.directive('dynamicTableRow', () => ({
|
|
template: '',
|
|
// AngularJS has a strange love to table-related tags, therefore
|
|
// we should use this directive as an attribute
|
|
restrict: 'A',
|
|
replace: false,
|
|
scope: {
|
|
columns: '=',
|
|
row: '=',
|
|
render: '=',
|
|
},
|
|
link: ($scope, $element) => {
|
|
$scope.$watch('render', () => {
|
|
if (isFunction($scope.render)) {
|
|
$scope.render($scope, (clonedElement) => {
|
|
$element.empty().append(clonedElement).append('<td></td>');
|
|
});
|
|
}
|
|
});
|
|
},
|
|
}));
|
|
}
|