Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Bug in limitTo filter when using negative begin parameter #12775

Closed
@scroach

Description

@scroach

There is an error in the limitTo filter begin/end position calculations.
I want to show a maximum 5 characters from a string no matter which length it is.

Therefore I am using this snippet: {{string | limitTo : 5 : -5 }}
I expect the filter to show max. 5 chars beginning from the -5 index. This works as long as the string is at least 5 characters long. If it is shorter the filter won't display anything!

Example here:
http://plnkr.co/edit/tSdeeQ1Ue8rxyapC11vV?p=preview

Bug seems to be in any 1.4.x version of angular.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions