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

Add possibility to set card template with attribute string or with inner HTML instead of using an external template file #24

Closed sebastianoe closed 10 years ago

sebastianoe commented 10 years ago

The card templates can now be provided by using a cardTemplateString attribute (which uses the attribute value as the template) or by omitting any template attributes (which uses the inner HTML of the directive as the template). Specs for these new features are included. This should fix both aspects of issue #7.

These examples (taken from the extended README.md) illustrate the new functionality:

cardTemplateString attribute:

<div deckgrid source="photos" cardTemplateString="<p>{{card.title}}</p>"></div>

No template-related attribute:

<div deckgrid source="photos">
    <div class="a-card">
        <h1>{{card.title}}</h1>

        <img src="" data-ng-src="{{card.src}}">
    </div>
</div>
akoenig commented 10 years ago

Excellent, @sebastianoe! Thanks for contributing this feature!