Skip to content

mboudreau/angular-mosaic

Repository files navigation

Mosaic

A simple, responsive, Masonry or Deckgrid like tile/grid system for Angular.

Works with Bootstrap. Works with IE8 and above, must include Respond.js for IE8 to work:

	<!--[if lt IE 9]>
	  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
	  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
	<![endif]-->

Getting Started

To install Angular Mosaic, you can simply use bower:

bower install angular-mosaic --save

Inject angular-mosaic module into your angular app

angular.module('myApp', ['codinghitchhiker.mosaic']);

Mosaic works very similarly to ng-repeat, except that it doesn't repeat the element that it's on, instead it uses the transcluded element(s) within mosaic. A quick example of this:

$scope.entities = ['one', 'two', 'three', 'four']

Then in your template file, add a simple iterator

	<ul mosaic="entity in entities">
		<li>{{entity}}</li>
	</ul>

This will work the same as an ng-repeat since it will only have one column because the css file hasn't been set. For Mosaic to be compatible with all browsers and to exclude the need for javascript to duplicate css media queries logic, a 'layout' element is added within Mosaic. Depending on the width of this layout element, it will set the amount of columns to display within mosaic

Example

You can play with it via this JSFiddle

About

A masonry, tile/grid system for Angular

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •