{"id":24658417,"url":"https://github.com/swingdev/angular-smart-models","last_synced_at":"2026-05-08T04:13:29.806Z","repository":{"id":58217844,"uuid":"46423335","full_name":"SwingDev/Angular-Smart-Models","owner":"SwingDev","description":"Smart Models for Angular JS","archived":false,"fork":false,"pushed_at":"2015-12-06T09:42:01.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-21T07:13:45.447Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/SwingDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2015-11-18T14:17:10.000Z","updated_at":"2015-12-23T14:06:00.000Z","dependencies_parsed_at":"2022-08-30T20:00:49.618Z","dependency_job_id":null,"html_url":"https://github.com/SwingDev/Angular-Smart-Models","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SwingDev/Angular-Smart-Models","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwingDev%2FAngular-Smart-Models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwingDev%2FAngular-Smart-Models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwingDev%2FAngular-Smart-Models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwingDev%2FAngular-Smart-Models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwingDev","download_url":"https://codeload.github.com/SwingDev/Angular-Smart-Models/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwingDev%2FAngular-Smart-Models/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267298603,"owners_count":24065882,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-01-26T01:35:20.089Z","updated_at":"2026-05-08T04:13:29.736Z","avatar_url":"https://github.com/SwingDev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular Smart Models\n\n## Overview\nAngular Smart Models is a angular wrapper for Smart Model library. It also provides interceptors for Angular $http so you can plug it to your project with almost no configuration.\n\n\n## Installation\nYou can install Angular Smart Model from bower and npm.\n### NPM\n```npm install angular-smart-models```\n### Bower\n```bower install angular-smart-models```\n\nThen include Smart Model and Angular Smart Model scripts after the angular\n```html\n\u003chead\u003e\n\u003cscript src=\"bower_components/angular/angular.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"bower_components/smart-models/dist/smart-models.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"bower_components/angular-smart-models/dist/angular-smart-models.js\"\u003e\u003c/script\u003e\n\u003c/head\u003e\n```\n\n### Usage\n\n\n### Basic Example\n```javascript\n\nclass User extends SmartModel { }\n\nangular.module('MyApp', [])\n.config(function(ModelInterceptorProvider) {\n\tModelInterceptorProvider.registerInterceptor({\n\t\tmodel: User,\n\t\turl: '/user/',\n\t\tmethod: ModelInterceptorProvider.ALL\n\t});\n});\n\nangular.module('MyApp')\n.controller('MainController', function($http) {\n\t$http.get('/user/1').success(function(user) {\n\t\t// user is of type User\n\t});\n});\n```\n\n### Usage with Collections\nYou can also provide the collection name and key in interceptor configuration. When the backend response with array of objects, the library will simply pack everything into the Collection of that type.\n```javascript\nclass Post extends SmartModel { }\nclass PostsCollection extends Collection { }\nangular.module('MyApp', [])\n.config(function(ModelInterceptorProvider) {\n\tModelInterceptorProvider.registerInterceptor({\n\t\tmodel: Post,\n\t\turl: '/my-post/',\n\t\tmethod: ModelInterceptorProvider.ALL,\n\t\tcollection: PostsCollection,\n\t\tcollectionKey: 'MyPosts'\n\t});\n})\n.controller('MyPostsController', function($http) {\n\t$scope.posts = PostsCollection.create('MyPosts'); // notice that we use the same collection class and collection key here\n\n\t$http.get('my-posts'); // and that's all we have to do here! We no longer need to call .success, the Collection will be filled with data in the interceptor and attached to $scope.posts !\n});\n```\n\n## Tests\nThe code is covered with tests, you can run them using `npm test`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswingdev%2Fangular-smart-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswingdev%2Fangular-smart-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswingdev%2Fangular-smart-models/lists"}