1
zu filtert Ich bin neu in AngularJS und ich möchte nur $ http Service Rückgabewert der Funktion so filtern folgenden Code ist ....
.filter('mapMedicine', function($http) {
return function(input) {
if (!input){
return '';
} else {
return $http.get('/rest-apis/medicines/'+input).then(function(response){
return response.data.name;
});
}
};
})
oben Funktion gibt {} zurück Wie funktioniert das? und ich bin mit Filter in uiGrid cellDropDown wie
$scope.bindGrid1={
enablePagination:false,
enableFiltering: true,
useExternalSorting: true,
enablePaginationControls: false,
columnDefs: [
{field: 'medicine', displayName: 'Medicine/Test', width: '20%',
cellFilter:"mapMedicine",
editableCellTemplate: 'ui-grid/dropdownEditor',
editDropdownIdLabel: 'id',
editDropdownValueLabel: 'name'
},
]
};
wie verwenden Sie/sie den Aufruf? –
mit uiGrid in columnDef cellFilter für Dropdown – Navjyot
Hier ist ein Beispiel, wie Sie einen Filter korrekt hinzufügen. http://stackoverflow.com/questions/25842194/angularjs-load-html-entity-as-currency-symbol-from-scope/25842874#25842874 Sie müssen die 'ng-bind-html verwenden 'angular Attribut –