{"id":17366799,"url":"https://github.com/thisissoon/angular-masonry","last_synced_at":"2025-04-15T02:42:52.400Z","repository":{"id":57166318,"uuid":"119044965","full_name":"thisissoon/angular-masonry","owner":"thisissoon","description":"A simple lightweight library to use Masonry layout in Angular","archived":false,"fork":false,"pushed_at":"2019-02-06T16:22:56.000Z","size":412,"stargazers_count":11,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T14:37:08.776Z","etag":null,"topics":["angular","masonry","masonry-grid","masonry-layout","ngx","ngx-library","ngx-masonry","ngx-masonry-grid","ngx-masonry-layout"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thisissoon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-26T11:38:51.000Z","updated_at":"2024-04-17T13:20:50.000Z","dependencies_parsed_at":"2022-08-30T15:10:14.505Z","dependency_job_id":null,"html_url":"https://github.com/thisissoon/angular-masonry","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisissoon%2Fangular-masonry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisissoon%2Fangular-masonry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisissoon%2Fangular-masonry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thisissoon%2Fangular-masonry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thisissoon","download_url":"https://codeload.github.com/thisissoon/angular-masonry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248614536,"owners_count":21133740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","masonry","masonry-grid","masonry-layout","ngx","ngx-library","ngx-masonry","ngx-masonry-grid","ngx-masonry-layout"],"created_at":"2024-10-15T22:05:02.400Z","updated_at":"2025-04-15T02:42:52.372Z","avatar_url":"https://github.com/thisissoon.png","language":"TypeScript","readme":"# Angular Masonry\n\n[![Build Status][circle-badge]][circle]\n[![Coverage Status][coveralls-badge]][coveralls]\n[![Commitizen friendly][commitizen-badge]][commitizen]\n[![code style: prettier][prettier-badge]][prettier-badge-url]\n\nA simple, lightweight library to use [Masonry][masonry] in [Angular][angular]\n\nThis is a simple library for [Angular][angular], implemented in the [Angular Package Format v5.0](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit#heading=h.k0mh3o8u5hx).\n\n## Install\n\n### via NPM\n\n`npm i @thisissoon/angular-masonry masonry-layout --save`\n\n### via Yarn\n\n`yarn add @thisissoon/angular-masonry masonry-layout`\n\n`app.module.ts`\n\n```ts\nimport { MasonryModule } from '@thisissoon/angular-masonry';\n\nconst masonryProviders = [\n  { provide: Masonry, useFactory: () =\u003e window['Masonry'] },\n];\n\n@NgModule({\n  imports: [MasonryModule.forRoot(masonryProviders)],\n})\nexport class AppModule {}\n```\n\n`angular.json`\n\nAdd the Masonry library javascript to your angular cli config\n\n```ts\n\"scripts\": [\n  \"../node_modules/masonry-layout/dist/masonry.pkgd.js\"\n],\n```\n\n#### Universal app (only needed if using platform-server)\n\n`app.server.module.ts`\n\n```ts\nimport { MasonryModule } from '@thisissoon/angular-masonry';\n\n@NgModule({\n  imports: [\n    // no need to provide window['Masonry'] here as\n    // a mock implemention is provided by default\n    MasonryModule.forRoot(),\n  ],\n})\nexport class AppServerModule {}\n```\n\n## Example\n\nA full working example can be found in the [src/app](https://github.com/thisissoon/angular-masonry/tree/master/src/app) folder.\n\n### `app.component.ts`\n\n```ts\nexport class AppComponent implements AfterViewInit, OnDestroy {\n  @ViewChild('grid') public grid: ElementRef;\n\n  public masonryInstance: MasonryInstance;\n\n  public cards = cards;\n\n  constructor(@Inject(Masonry) public masonry) {}\n\n  ngAfterViewInit() {\n    const options: MasonryOptions = {\n      itemSelector: '.card',\n      columnWidth: '.card',\n      gutter: 20,\n      fitWidth: true,\n    };\n    this.masonryInstance = new this.masonry(this.grid.nativeElement, options);\n  }\n\n  layout() {\n    this.masonryInstance.layout();\n  }\n\n  ngOnDestroy() {\n    this.masonryInstance.destroy();\n  }\n}\n```\n\n### `app.component.css`\n\nStyling is just an example\n\n```css\n:host {\n  display: block;\n  margin-top: 1rem;\n}\n\n.grid {\n  margin: 0 auto;\n}\n\n.card {\n  display: inline-block;\n  margin-bottom: 1rem;\n  width: 18rem;\n}\n```\n\n### `app.component.html`\n\n```html\n\u003cdiv class=\"grid\" #grid\u003e\n  \u003cdiv class=\"card\" *ngFor=\"let card of cards\"\u003e\n    \u003cdiv class=\"card-body\"\u003e\n      \u003ch5 class=\"card-title\"\u003e{{ card.title }}\u003c/h5\u003e\n      \u003cp class=\"card-text\"\u003e{{ card.text }}\u003c/p\u003e\n      \u003ca href=\"#\" class=\"btn btn-primary\"\u003eGo somewhere\u003c/a\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma][karma].\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via [Protractor][protractor].\n\n## Making Commits\n\nThis repo uses [Commitizen CLI][commitizen] and [Conventional Changelog][conventional-changelog] to create commits and generate changelogs. Instead of running `git commit` run `git cz` and follow the prompts. Changelogs will then be generated when creating new releases by running `npm run release`.\n\n## Making Releases\n\nRun `npm run release` to create a new release. This will use [Standard Version][standard-version] to create a new release. [Standard Version][standard-version] will generate / update the changelog based on commits generated using [Commitizen CLI][commitizen], update the version number following semantic versioning rules and then commit and tag the commit for the release. Simply run `git push --follow-tags origin master`.\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README][angular-cli-readme].\n\n[circle]: https://circleci.com/gh/thisissoon/angular-masonry\n[circle-badge]: https://circleci.com/gh/thisissoon/angular-masonry.svg?style=shield\n[coveralls]: https://coveralls.io/github/thisissoon/angular-masonry?branch=master\n[coveralls-badge]: https://coveralls.io/repos/github/thisissoon/angular-masonry/badge.svg?branch=master\n[commitizen]: http://commitizen.github.io/cz-cli/\n[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[prettier-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=shield\n[prettier-badge-url]: https://github.com/prettier/prettier\n[conventional-changelog]: https://github.com/conventional-changelog/conventional-changelog\n[standard-version]: https://github.com/conventional-changelog/standard-version\n[karma]: https://karma-runner.github.io\n[protractor]: http://www.protractortest.org/\n[angular]: https://angular.io/\n[angular-cli]: https://github.com/angular/angular-cli\n[angular-cli-readme]: https://github.com/angular/angular-cli/blob/master/README.md\n[masonry]: https://masonry.desandro.com/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisissoon%2Fangular-masonry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthisissoon%2Fangular-masonry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthisissoon%2Fangular-masonry/lists"}