michaelbromley / michaelbromley/angularUtils

passing Empty Array to directive

Open
#458 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2k
Forks
842
PR merge metrics
No merged PRs in 30d

Description

Hi

I am using **dirPagination** directive, i have a problem with passing empy array to it.

i have a table and a search field that search results show in table, when the result is empty, table rows does not delete from table,

i find this condition in directive

`scope.$watchCollection(function() {
return collectionGetter(scope);
}, function(collection) {
if (collection) {
paginationService.setCollectionLength(paginationId, collection.length);
}
});`

i think `if(collection)` make some problems.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the dirPagination directive's $watchCollection callback shown in the issue and trace how collection changes update the pagination service and table rows. Reproduce the empty-search-result case, then verify that passing an empty array removes the existing rows without breaking pagination.

Written by the indexing model from the issue text.

Assessment

Tech stack
angularjs, javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.