{"id":20314338,"url":"https://github.com/normandy72/modules","last_synced_at":"2026-05-07T01:35:28.101Z","repository":{"id":153902822,"uuid":"590837704","full_name":"Normandy72/Modules","owner":"Normandy72","description":"Modules in AngularJS. Coursera course \"Single Page Web Applications with AngularJS\" by Yaakov Chaikin.","archived":false,"fork":false,"pushed_at":"2023-01-19T12:37:19.000Z","size":169,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-03T20:43:09.892Z","etag":null,"topics":["angular","angularjs","css","css3","html","html5","javascript","js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Normandy72.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-01-19T10:31:50.000Z","updated_at":"2023-01-19T12:37:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"2bd49e0e-285e-4bb1-9036-d2f564730df0","html_url":"https://github.com/Normandy72/Modules","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Normandy72/Modules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Normandy72","download_url":"https://codeload.github.com/Normandy72/Modules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Normandy72%2FModules/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32719570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-07T00:29:05.620Z","status":"ssl_error","status_checked_at":"2026-05-07T00:28:57.074Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["angular","angularjs","css","css3","html","html5","javascript","js"],"created_at":"2024-11-14T18:14:51.852Z","updated_at":"2026-05-07T01:35:28.075Z","avatar_url":"https://github.com/Normandy72.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Modules in AngularJS\n## Steps to create modules\n#### Step 1: Declare / Create Module\n```\nangular.module('module1', []);\n```\n`.module` - declare module\n`'module1'` - unique module name\n`[]` - dependencies\n\n##### Specify other modules as dependencies\n```\n// no dependencies\nangular.module('module1', []);\nangular.module('module2', []);\n\n// dependent on module1 and module2\nangular.module('module3', ['module1', 'module2']);\n```\n#### Step 2: Declare Module Artifacts\n```\nangular.module('module1')\n.controller('MyController', MyController);\n```\n`('module1')` - second argument missing!\n#### Step 3: ng-app='MainModule'\n```\n\u003c!DOCTYPE html\u003e\n\u003chtml ng-app='module3'\u003e\n...\n\u003c/html\u003e\n```\n## Splitting Javascript into Several Files\n```\n\u003cscript src=\"src/mod1/module1.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"src/mod1/controller.js\"\u003e\u003c/script\u003e\n\n\u003cscript src=\"src/mod2/module2.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"src/mod2/component.js\"\u003e\u003c/script\u003e\n```\n`\u003cscript src=\".../module1.js\"\u003e\u003c/script\u003e` - declare / create 'module1'\n`\u003cscript src=\".../controller.js\"\u003e\u003c/script\u003e` - retrieve \u0026 use to declare Controller\n\n##### Also correct variant\nmodule2 before module1\n```\n\u003cscript src=\"src/mod2/module2.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"src/mod2/component.js\"\u003e\u003c/script\u003e\n\n\u003cscript src=\"src/mod1/module1.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"src/mod1/controller.js\"\u003e\u003c/script\u003e\n```\n##### Incorrect variant\nbecause component uses module2 (using module2 before it's created)\n```\n\u003cscript src=\"src/mod2/component.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"src/mod2/module2.js\"\u003e\u003c/script\u003e\n```\n## Configuration and Run Blocks\n#### .config\n```\nangular.module('module1')\n.config(function(){\n    ...\n});\n```\n`function()` - inject only Providers and Constants\n#### .run\n```\nangular.module('module1')\n.run(function(){\n    ...\n});\n```\n`function()` - inject only Instances (like Services) and Constants\n***\n#### _Summary_\n* `angular.module` method takes 2 arguments to create a module:\n    * name of module;\n    * array of string module name dependencies.\n* `angular.module` method with just name of module retrieves the previously created method. Then, you can declare components, controllers, etc., on it.\n* `module.config` method fires before module.run method.\n* All dependency modules get configured first.\n* It doesn't matter which modules are listed first as long as module declarations are listed before artifact declarations on that module. \n***","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnormandy72%2Fmodules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnormandy72%2Fmodules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnormandy72%2Fmodules/lists"}