akoenig / angular-deckgrid

A lightweight masonry-like grid for AngularJS.
http://akoenig.github.io/angular-deckgrid
MIT License
1.1k stars 191 forks source link

Comma gets inserted in deckgrid template #85

Open dorthrithil opened 9 years ago

dorthrithil commented 9 years ago

If you provide the template via the inner HTML option, a <span class="ng-scope">,</span> element is added between all direct child elements of the .deckgrid div.

So if you define a template like

<div deckgrid source="..." class="deckgrid">
  <div>...</div>
  <div>...</div>
</div>

each card will be displayed as

  <div>...</div>
  <span class="ng-scope">,</span>
  <div>...</div>

You can easily work around this by adding a parent div which wraps the whole template but the whole issue first was really confusing. Is this comma inserting intended?

mjhasbach commented 8 years ago

+1

rparrapy commented 8 years ago

+1

caffeinewriter commented 6 years ago

I know this is years later, but I figured out the root cause. It seems to have to do with inserting into the template cache, and relying on .join()'s default string.

In a quick test on Chrome 60.0.3112.113, running ["test", "string", "here"].join(), returns "test,string,here". Adding a parent div fixes this issue since it gives the join only a single element to the array, so no commas are added. It doesn't look like pull requests are being accepted, but the fix should be as simple as changing .join(), to .join(""). I'll throw together a pull request when I have the chance.