angular-deckgrid icon indicating copy to clipboard operation
angular-deckgrid copied to clipboard

Comma gets inserted in deckgrid template

Open dorthrithil opened this issue 10 years ago • 3 comments

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?

dorthrithil avatar Jun 07 '15 20:06 dorthrithil

+1

mjhasbach avatar Oct 09 '15 17:10 mjhasbach

+1

rparrapy avatar Oct 10 '15 13:10 rparrapy

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.

caffeinewriter avatar Sep 13 '17 03:09 caffeinewriter