How to apply filters to *ngFor?

前端 未结 23 1286
無奈伤痛
無奈伤痛 2020-11-22 03:44

Apparently, Angular 2 will use pipes instead of filters as in Angular1 in conjunction with ng-for to filter results, although the implementation still seems to be vague, wit

23条回答
  •  遥遥无期
    2020-11-22 04:11

    I know its an old question, however, I thought it might be helpful to offer another solution.

    equivalent of AngularJS of this

    in Angular 2+ you cant use *ngFor and *ngIf on a same element, so it will be following:

    and if you can not use as internal container use ng-container instead. ng-container is useful when you want to conditionally append a group of elements (ie using *ngIf="foo") in your application but don't want to wrap them with another element.

提交回复
热议问题