{"id":13808358,"url":"https://github.com/fidian/ngx-mutation-observer","last_synced_at":"2025-04-10T20:31:40.366Z","repository":{"id":42061867,"uuid":"207656790","full_name":"fidian/ngx-mutation-observer","owner":"fidian","description":"Get Angular 8+ events fired when an element is mutated in the DOM.","archived":false,"fork":false,"pushed_at":"2024-12-23T21:15:42.000Z","size":2456,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T04:18:27.229Z","etag":null,"topics":[],"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/fidian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-10T20:27:43.000Z","updated_at":"2024-12-23T21:15:42.000Z","dependencies_parsed_at":"2024-05-08T19:45:39.529Z","dependency_job_id":"c2545bd2-7dff-410f-8cd3-12c6012b6315","html_url":"https://github.com/fidian/ngx-mutation-observer","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/fidian%2Fngx-mutation-observer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fidian%2Fngx-mutation-observer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fidian%2Fngx-mutation-observer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fidian%2Fngx-mutation-observer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fidian","download_url":"https://codeload.github.com/fidian/ngx-mutation-observer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248290040,"owners_count":21078923,"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":[],"created_at":"2024-08-04T01:01:40.806Z","updated_at":"2025-04-10T20:31:40.345Z","avatar_url":"https://github.com/fidian.png","language":"TypeScript","funding_links":[],"categories":["Third Party Components"],"sub_categories":["DOM"],"readme":"# NgxMutationObserver\n\nAngular 19.x library to monitor changes to elements. Uses MutationObserver to do the work.\n\nIf you're only looking for a way to see if elements are visible, I suggest checking out [ngx-visibility](https://github.com/fidian/ngx-visibility) instead. This doesn't notice everything - for instance, an element whose width is set to \"50%\" will not report a mutation when the window is resized or when a scrollbar is visible. Instead, a mutation is reported when the width is changed from \"50%\" to \"75%\" or to \"128px\".\n\nIf you only care about when elements are resized, including resize events due to browser window size changing, look at [ngx-resize-observer](https://github.com/fidian/ngx-resize-observer/).\n\n\n## Demonstration\n\nThere's a [live demo](https://codesandbox.io/s/github/fidian/ngx-mutation-observer-demo/tree/master/) over at CodeSandbox.io.\n\n\n## Installation\n\nInstall like other Angular libraries. First run a command to download the module.\n\n    npm install ngx-mutation-observer\n\nNext, add the module to your project.\n\n    import { BrowserModule } from '@angular/platform-browser';\n    import { NgModule } from '@angular/core';\n    import { FormsModule } from '@angular/forms';\n\n    // Import the module\n    import { NgxMutationObserverModule } from 'ngx-mutation-observer';\n\n    import { AppComponent } from './app.component';\n\n    @NgModule({\n        declarations: [AppComponent, ItemComponent],\n\n        // Include the module.\n        imports: [BrowserModule, FormsModule, NgxMutationObserverModule],\n        providers: [],\n        bootstrap: [AppComponent]\n    })\n    export class AppModule {}\n\nFinally, you leverage the service directly or use some directives for common uses.\n\n\n## NgxMutationObserverDirective\n\nEmits `MutationRecord[]` when a mutation is detected.\n\n    \u003cdiv (onMutation)=\"handleMutation($event)\"\u003e\u003c/div\u003e\n\nConfiguration is allowed through the `mutationConfig` directive. When not specified, this defaults to `{attributes: true, characterData: true, childList: true }`. You are allowed to specify anything allowed in [the interface](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserverInit). For instance, if you only care about the size of an element changing, you would only watch its attributes.\n\n    \u003cdiv (onMutation)=\"attributesChanged($event)\" [mutationConfig]=\"{attributes: true}\"\u003e\u003c/div\u003e\n\n\n## License\n\nThis project is licensed under an [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffidian%2Fngx-mutation-observer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffidian%2Fngx-mutation-observer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffidian%2Fngx-mutation-observer/lists"}