3
I am trying to insert a dynamic filter according to a field of an object in the ng-grid
. I tried so many ways and I couldn’t:
$scope.gridOptions.columnDefs = [
{ displayName: 'entity.tipoPessoa', field: 'tipoPessoa'},
{ displayName: 'entity.id', field: 'id', cellTemplate: '<div class=\"ngCellText\" ng-class=\"col.colIndex()\"><span ng-cell-text>[Insira o trecho de código aqui]</span></div>'},
//...
]:
Code snippet:
{{ row.entity.tipoPessoa == "F" ? row.entity.id | brCpf : row.entity.id | brCnpj }}
{{ row.entity.tipoPessoa == "F" ? "row.entity.id | brCpf" : "row.entity.id | brCnpj" }}
{{ row.entity.tipoPessoa == "F" ? "{{row.entity.id | brCpf}}" : "{{row.entity.id | brCnpj}}" }}
{{ row.entity.tipoPessoa == "F" ? {{row.entity.id | brCpf}} : {{row.entity.id | brCnpj}} }}
None of these ways worked. What’s the right way to do it? Should I try another approach?
Angular does not support operator
?
. Use aspan
withngIf
. The filtersbrCpf
, etc, are set and working correctly in a simple case? Which error got? What was expected? Any error in the console?– Vinícius Gobbo A. de Oliveira
There was no error in the console, but it presented the string (Row.entity.id | brCpf) and not "ran it".
– Vitor Vezani