AngularJS - placeholder for empty result from filter

前端 未结 3 1009
清歌不尽
清歌不尽 2020-11-29 16:35

I want to have a place holder, e.g. when filter result returns empty. Could anyone please help? I don\'t even know where to start...

<

3条回答
  •  长情又很酷
    2020-11-29 16:59

    Taken from this official document that's how they do it:

    ng-repeat="friend in friends | filter:q as results"
    

    Then use the results as an array

  • No results found...
  • Full snippet:

    I have {{friends.length}} friends. They are:
    • [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
    • No results found...

提交回复
热议问题