├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── backend ├── data.json ├── package-lock.json ├── package.json └── server.js ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.css │ ├── app.component.html │ ├── app.component.ts │ ├── app.module.ts │ ├── components │ │ ├── add-item │ │ │ ├── add-item.component.css │ │ │ ├── add-item.component.html │ │ │ └── add-item.component.ts │ │ ├── header │ │ │ ├── header.component.css │ │ │ ├── header.component.html │ │ │ └── header.component.ts │ │ ├── items │ │ │ ├── items.component.css │ │ │ ├── items.component.html │ │ │ └── items.component.ts │ │ ├── shopping-item │ │ │ ├── shopping-item.component.css │ │ │ ├── shopping-item.component.html │ │ │ └── shopping-item.component.ts │ │ └── total │ │ │ ├── total.component.css │ │ │ ├── total.component.html │ │ │ └── total.component.ts │ ├── models │ │ └── Item.ts │ └── services │ │ └── item.service.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── main.ts ├── polyfills.ts ├── styles.css └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line. 18 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 19 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AngularTodos 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.2.0. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. 28 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "angular-todos": { 7 | "projectType": "application", 8 | "schematics": {}, 9 | "root": "", 10 | "sourceRoot": "src", 11 | "prefix": "app", 12 | "architect": { 13 | "build": { 14 | "builder": "@angular-devkit/build-angular:browser", 15 | "options": { 16 | "outputPath": "dist/angular-todos", 17 | "index": "src/index.html", 18 | "main": "src/main.ts", 19 | "polyfills": "src/polyfills.ts", 20 | "tsConfig": "tsconfig.app.json", 21 | "aot": true, 22 | "assets": [ 23 | "src/favicon.ico", 24 | "src/assets" 25 | ], 26 | "styles": [ 27 | "src/styles.css" 28 | ], 29 | "scripts": [] 30 | }, 31 | "configurations": { 32 | "production": { 33 | "fileReplacements": [ 34 | { 35 | "replace": "src/environments/environment.ts", 36 | "with": "src/environments/environment.prod.ts" 37 | } 38 | ], 39 | "optimization": true, 40 | "outputHashing": "all", 41 | "sourceMap": false, 42 | "extractCss": true, 43 | "namedChunks": false, 44 | "extractLicenses": true, 45 | "vendorChunk": false, 46 | "buildOptimizer": true, 47 | "budgets": [ 48 | { 49 | "type": "initial", 50 | "maximumWarning": "2mb", 51 | "maximumError": "5mb" 52 | }, 53 | { 54 | "type": "anyComponentStyle", 55 | "maximumWarning": "6kb", 56 | "maximumError": "10kb" 57 | } 58 | ] 59 | } 60 | } 61 | }, 62 | "serve": { 63 | "builder": "@angular-devkit/build-angular:dev-server", 64 | "options": { 65 | "browserTarget": "angular-todos:build" 66 | }, 67 | "configurations": { 68 | "production": { 69 | "browserTarget": "angular-todos:build:production" 70 | } 71 | } 72 | }, 73 | "extract-i18n": { 74 | "builder": "@angular-devkit/build-angular:extract-i18n", 75 | "options": { 76 | "browserTarget": "angular-todos:build" 77 | } 78 | }, 79 | "test": { 80 | "builder": "@angular-devkit/build-angular:karma", 81 | "options": { 82 | "main": "src/test.ts", 83 | "polyfills": "src/polyfills.ts", 84 | "tsConfig": "tsconfig.spec.json", 85 | "karmaConfig": "karma.conf.js", 86 | "assets": [ 87 | "src/favicon.ico", 88 | "src/assets" 89 | ], 90 | "styles": [ 91 | "src/styles.css" 92 | ], 93 | "scripts": [] 94 | } 95 | }, 96 | "lint": { 97 | "builder": "@angular-devkit/build-angular:tslint", 98 | "options": { 99 | "tsConfig": [ 100 | "tsconfig.app.json", 101 | "tsconfig.spec.json", 102 | "e2e/tsconfig.json" 103 | ], 104 | "exclude": [ 105 | "**/node_modules/**" 106 | ] 107 | } 108 | }, 109 | "e2e": { 110 | "builder": "@angular-devkit/build-angular:protractor", 111 | "options": { 112 | "protractorConfig": "e2e/protractor.conf.js", 113 | "devServerTarget": "angular-todos:serve" 114 | }, 115 | "configurations": { 116 | "production": { 117 | "devServerTarget": "angular-todos:serve:production" 118 | } 119 | } 120 | } 121 | } 122 | }}, 123 | "defaultProject": "angular-todos" 124 | } 125 | -------------------------------------------------------------------------------- /backend/data.json: -------------------------------------------------------------------------------- 1 | [{"title":"Pan","price":"4","quantity":"5","completed":false,"id":"c28bf4f2-5b02-449c-a798-901c5a6b0eb9"},{"id":"a51f811f-8349-42f0-bd6d-6cc9e333a7f2","title":"amet tempor aute culpa aliquip proident","price":591.553,"quantity":16,"completed":true},{"id":"89ab7401-bb6f-491e-9562-f2b74c9a6182","title":"tempor aliqua culpa officia Lorem laboris","price":483.015,"quantity":39,"completed":true},{"id":"dfeb2780-8fde-4059-a301-3167885668fd","title":"et adipisicing ipsum minim elit in","price":934.939,"quantity":33,"completed":true},{"id":"ff49efd9-0bc3-4e68-a88e-479c94b370ae","title":"tempor ipsum et est dolore occaecat","price":919.368,"quantity":10,"completed":true},{"id":"a5491ee1-21ae-4da6-8816-f866e163b229","title":"eiusmod consectetur voluptate consectetur dolor ea","price":797.683,"quantity":52,"completed":false},{"id":"3cdca18b-d2db-4e68-82bf-066c1239391c","title":"sint do Lorem nulla exercitation culpa","price":297.143,"quantity":41,"completed":true},{"id":"e29033a3-7542-4c3d-8bcc-a90762e4b921","title":"fugiat proident cillum ad commodo ea","price":559.113,"quantity":74,"completed":false},{"id":"c7981570-ba25-47f3-9e68-4e28fef2b1e1","title":"ex esse minim pariatur culpa Lorem","price":560.205,"quantity":75,"completed":true},{"id":"8a56f182-9963-4e61-a8c9-7f4dbaadfdb3","title":"cupidatat non ipsum eu fugiat velit","price":625.463,"quantity":55,"completed":true},{"id":"a3750546-4d48-4be5-8cab-b97d097f2782","title":"sunt excepteur sunt proident proident nostrud","price":209.968,"quantity":63,"completed":true},{"id":"b4ccf03c-3bcf-4158-9571-fbea384621a6","title":"est magna duis minim ut irure","price":293.203,"quantity":64,"completed":false},{"id":"7b111e0d-4304-4906-85bd-d336f493f13f","title":"nisi est reprehenderit eiusmod cupidatat in","price":535.162,"quantity":78,"completed":false},{"id":"c862970a-0a89-4273-90e6-5fd23f914fbd","title":"amet adipisicing nisi sunt ut eu","price":159.5,"quantity":57,"completed":true},{"id":"1e9f7eb1-2024-45f3-8719-12cdb4881594","title":"sint ex consectetur cillum ea sint","price":992.71,"quantity":5,"completed":true},{"id":"90698c8e-119b-4f9b-84eb-ea0e37ab20f6","title":"veniam quis incididunt adipisicing aute eiusmod","price":588.517,"quantity":15,"completed":false},{"id":"a9d4d796-29cd-4f2d-9090-634ec13e1d4b","title":"nisi dolore incididunt Lorem anim nostrud","price":598.2,"quantity":64,"completed":false},{"id":"2bb15b80-aec3-4a91-9053-04e323f01236","title":"occaecat aute in laboris pariatur cupidatat","price":313.291,"quantity":58,"completed":true},{"id":"d8af217f-f633-4fbd-b9f3-d3779d0d6f11","title":"enim et velit officia eu pariatur","price":628.437,"quantity":10,"completed":true},{"id":"9930e613-e711-41a9-ab49-5b707aa29867","title":"duis aute anim dolore anim velit","price":954.388,"quantity":17,"completed":false},{"id":"31ac9d30-0c80-4be0-a13d-7749d22d849d","title":"enim ullamco ipsum ullamco nostrud dolore","price":400.122,"quantity":11,"completed":false},{"id":"f6a9eef8-0251-40b6-9c1a-c02315d26eee","title":"ad ad est sit officia mollit","price":658.755,"quantity":64,"completed":false},{"id":"c7f4125c-4cd0-4216-8599-7029514502ee","title":"fugiat consectetur cillum consequat aute tempor","price":799.417,"quantity":8,"completed":true},{"id":"8728d78d-9416-42db-b390-e209cacb09ed","title":"esse dolor amet eu proident veniam","price":515.34,"quantity":67,"completed":false},{"id":"50e98e61-4b4c-4421-9311-731c5aa8b617","title":"nisi ex velit do laboris nulla","price":907.638,"quantity":51,"completed":false},{"id":"fb94a9b4-eb5b-4160-ab97-c695d940bf09","title":"enim non deserunt exercitation sint id","price":246.681,"quantity":44,"completed":true},{"id":"fa52b0e1-d26f-489b-b64c-36e00b1d8aa5","title":"non ex Lorem commodo nostrud laboris","price":720.009,"quantity":78,"completed":true},{"id":"964208e5-e16e-4dc3-980f-e5640626a51a","title":"ex magna aliquip nisi eiusmod culpa","price":539.45,"quantity":39,"completed":false},{"id":"e73e30c7-ba7e-4b5d-9e33-3108b09f59fe","title":"proident excepteur aute ex irure incididunt","price":712.631,"quantity":6,"completed":true},{"id":"4e1d1367-2305-4f09-b3e4-7a8409642e40","title":"incididunt labore minim adipisicing occaecat tempor","price":334.195,"quantity":24,"completed":true},{"id":"6aab4677-6672-433d-bc73-690f94253c5c","title":"cillum reprehenderit enim tempor ipsum irure","price":549.189,"quantity":6,"completed":false},{"id":"8c068827-0255-40f3-9eaa-1551b0e168ba","title":"excepteur nisi adipisicing aliqua voluptate laboris","price":806.55,"quantity":5,"completed":true},{"id":"2ddebcb7-0492-48dc-aa7d-a83487cd0c08","title":"excepteur sunt Lorem aliquip pariatur exercitation","price":208.175,"quantity":2,"completed":true},{"id":"ecd28077-e282-4926-8270-8a5f229587f5","title":"culpa minim laborum culpa laborum dolor","price":945.365,"quantity":79,"completed":false},{"id":"51f1774b-31c4-4601-aeb5-66a09ed7e6fc","title":"cupidatat ut ea exercitation tempor irure","price":60.435,"quantity":68,"completed":true},{"id":"1ec8e9b6-b4fc-43ef-8a8e-d5efc562983a","title":"irure incididunt culpa sunt cillum duis","price":775.473,"quantity":9,"completed":false},{"id":"7c2316f8-6cba-4be4-a697-c4878261a05b","title":"velit cillum sint non dolore eiusmod","price":615.118,"quantity":58,"completed":true},{"id":"a9c66b87-b10c-45db-84da-2e9e7e0d689d","title":"id deserunt ipsum labore aute esse","price":20.838,"quantity":61,"completed":true},{"id":"29199a03-f6ad-4a6b-b007-b916b6dc411f","title":"consectetur culpa eu ipsum in sit","price":31.02,"quantity":14,"completed":false},{"id":"6093bc4a-3fa9-4cc3-9597-2e593142fb2e","title":"ipsum fugiat ullamco tempor irure irure","price":178.858,"quantity":42,"completed":true},{"id":"ae6ba542-eb97-46ee-bfd3-d72fba97209f","title":"fugiat laborum dolore ex pariatur sit","price":900.831,"quantity":65,"completed":false},{"id":"f3da4a9f-4222-435b-a302-ce97e8696caa","title":"nulla ut irure sit laboris amet","price":663.467,"quantity":63,"completed":false},{"id":"77fa7c00-bec5-4480-9694-d845ca80831f","title":"reprehenderit veniam aliquip proident in deserunt","price":273.421,"quantity":30,"completed":true},{"id":"96f3f678-25d6-4031-aa64-abdbfd38946a","title":"id Lorem do qui Lorem dolor","price":702.698,"quantity":36,"completed":true},{"id":"30c98058-ce95-4f91-9cbd-e1b40120bfa3","title":"consectetur sunt do velit do ad","price":513.401,"quantity":56,"completed":true},{"id":"5d617d48-7d71-44e4-be28-7b62c7398d9b","title":"qui aliqua nisi ipsum ullamco pariatur","price":643.863,"quantity":37,"completed":false},{"id":"e5c9163c-dbd3-457d-a341-00d440a38db4","title":"officia qui reprehenderit et excepteur anim","price":719.444,"quantity":4,"completed":true},{"id":"9da4f8d6-a750-4967-888e-bbefc976cb1d","title":"laborum velit fugiat et amet fugiat","price":236.201,"quantity":29,"completed":false},{"id":"8ace991e-a4b6-46cd-ad9f-9d10d5c5aa95","title":"eiusmod esse nulla eu aliqua sunt","price":921.309,"quantity":21,"completed":false},{"id":"6081e92c-43ac-4a44-a9e8-0d9c4aa8dded","title":"sunt adipisicing minim mollit exercitation culpa","price":561.009,"quantity":54,"completed":false}] -------------------------------------------------------------------------------- /backend/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "accepts": { 8 | "version": "1.3.7", 9 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 10 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 11 | "requires": { 12 | "mime-types": "~2.1.24", 13 | "negotiator": "0.6.2" 14 | } 15 | }, 16 | "array-flatten": { 17 | "version": "1.1.1", 18 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 19 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 20 | }, 21 | "body-parser": { 22 | "version": "1.19.0", 23 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", 24 | "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", 25 | "requires": { 26 | "bytes": "3.1.0", 27 | "content-type": "~1.0.4", 28 | "debug": "2.6.9", 29 | "depd": "~1.1.2", 30 | "http-errors": "1.7.2", 31 | "iconv-lite": "0.4.24", 32 | "on-finished": "~2.3.0", 33 | "qs": "6.7.0", 34 | "raw-body": "2.4.0", 35 | "type-is": "~1.6.17" 36 | } 37 | }, 38 | "bytes": { 39 | "version": "3.1.0", 40 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", 41 | "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" 42 | }, 43 | "content-disposition": { 44 | "version": "0.5.3", 45 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", 46 | "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", 47 | "requires": { 48 | "safe-buffer": "5.1.2" 49 | } 50 | }, 51 | "content-type": { 52 | "version": "1.0.4", 53 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 54 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 55 | }, 56 | "cookie": { 57 | "version": "0.4.0", 58 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", 59 | "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" 60 | }, 61 | "cookie-signature": { 62 | "version": "1.0.6", 63 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 64 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 65 | }, 66 | "cors": { 67 | "version": "2.8.5", 68 | "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", 69 | "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", 70 | "requires": { 71 | "object-assign": "^4", 72 | "vary": "^1" 73 | } 74 | }, 75 | "debug": { 76 | "version": "2.6.9", 77 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 78 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 79 | "requires": { 80 | "ms": "2.0.0" 81 | } 82 | }, 83 | "depd": { 84 | "version": "1.1.2", 85 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 86 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 87 | }, 88 | "destroy": { 89 | "version": "1.0.4", 90 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 91 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 92 | }, 93 | "ee-first": { 94 | "version": "1.1.1", 95 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 96 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 97 | }, 98 | "encodeurl": { 99 | "version": "1.0.2", 100 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 101 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 102 | }, 103 | "escape-html": { 104 | "version": "1.0.3", 105 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 106 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 107 | }, 108 | "etag": { 109 | "version": "1.8.1", 110 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 111 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 112 | }, 113 | "express": { 114 | "version": "4.17.1", 115 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", 116 | "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", 117 | "requires": { 118 | "accepts": "~1.3.7", 119 | "array-flatten": "1.1.1", 120 | "body-parser": "1.19.0", 121 | "content-disposition": "0.5.3", 122 | "content-type": "~1.0.4", 123 | "cookie": "0.4.0", 124 | "cookie-signature": "1.0.6", 125 | "debug": "2.6.9", 126 | "depd": "~1.1.2", 127 | "encodeurl": "~1.0.2", 128 | "escape-html": "~1.0.3", 129 | "etag": "~1.8.1", 130 | "finalhandler": "~1.1.2", 131 | "fresh": "0.5.2", 132 | "merge-descriptors": "1.0.1", 133 | "methods": "~1.1.2", 134 | "on-finished": "~2.3.0", 135 | "parseurl": "~1.3.3", 136 | "path-to-regexp": "0.1.7", 137 | "proxy-addr": "~2.0.5", 138 | "qs": "6.7.0", 139 | "range-parser": "~1.2.1", 140 | "safe-buffer": "5.1.2", 141 | "send": "0.17.1", 142 | "serve-static": "1.14.1", 143 | "setprototypeof": "1.1.1", 144 | "statuses": "~1.5.0", 145 | "type-is": "~1.6.18", 146 | "utils-merge": "1.0.1", 147 | "vary": "~1.1.2" 148 | } 149 | }, 150 | "finalhandler": { 151 | "version": "1.1.2", 152 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 153 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 154 | "requires": { 155 | "debug": "2.6.9", 156 | "encodeurl": "~1.0.2", 157 | "escape-html": "~1.0.3", 158 | "on-finished": "~2.3.0", 159 | "parseurl": "~1.3.3", 160 | "statuses": "~1.5.0", 161 | "unpipe": "~1.0.0" 162 | } 163 | }, 164 | "forwarded": { 165 | "version": "0.1.2", 166 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 167 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" 168 | }, 169 | "fresh": { 170 | "version": "0.5.2", 171 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 172 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 173 | }, 174 | "http-errors": { 175 | "version": "1.7.2", 176 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", 177 | "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", 178 | "requires": { 179 | "depd": "~1.1.2", 180 | "inherits": "2.0.3", 181 | "setprototypeof": "1.1.1", 182 | "statuses": ">= 1.5.0 < 2", 183 | "toidentifier": "1.0.0" 184 | } 185 | }, 186 | "iconv-lite": { 187 | "version": "0.4.24", 188 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 189 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 190 | "requires": { 191 | "safer-buffer": ">= 2.1.2 < 3" 192 | } 193 | }, 194 | "inherits": { 195 | "version": "2.0.3", 196 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 197 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 198 | }, 199 | "ipaddr.js": { 200 | "version": "1.9.1", 201 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", 202 | "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" 203 | }, 204 | "media-typer": { 205 | "version": "0.3.0", 206 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 207 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 208 | }, 209 | "merge-descriptors": { 210 | "version": "1.0.1", 211 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 212 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 213 | }, 214 | "methods": { 215 | "version": "1.1.2", 216 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 217 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 218 | }, 219 | "mime": { 220 | "version": "1.6.0", 221 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 222 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 223 | }, 224 | "mime-db": { 225 | "version": "1.44.0", 226 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", 227 | "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" 228 | }, 229 | "mime-types": { 230 | "version": "2.1.27", 231 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", 232 | "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", 233 | "requires": { 234 | "mime-db": "1.44.0" 235 | } 236 | }, 237 | "ms": { 238 | "version": "2.0.0", 239 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 240 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 241 | }, 242 | "negotiator": { 243 | "version": "0.6.2", 244 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 245 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" 246 | }, 247 | "object-assign": { 248 | "version": "4.1.1", 249 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 250 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" 251 | }, 252 | "on-finished": { 253 | "version": "2.3.0", 254 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 255 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 256 | "requires": { 257 | "ee-first": "1.1.1" 258 | } 259 | }, 260 | "parseurl": { 261 | "version": "1.3.3", 262 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 263 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 264 | }, 265 | "path-to-regexp": { 266 | "version": "0.1.7", 267 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 268 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 269 | }, 270 | "proxy-addr": { 271 | "version": "2.0.6", 272 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", 273 | "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", 274 | "requires": { 275 | "forwarded": "~0.1.2", 276 | "ipaddr.js": "1.9.1" 277 | } 278 | }, 279 | "qs": { 280 | "version": "6.7.0", 281 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", 282 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" 283 | }, 284 | "range-parser": { 285 | "version": "1.2.1", 286 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 287 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 288 | }, 289 | "raw-body": { 290 | "version": "2.4.0", 291 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", 292 | "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", 293 | "requires": { 294 | "bytes": "3.1.0", 295 | "http-errors": "1.7.2", 296 | "iconv-lite": "0.4.24", 297 | "unpipe": "1.0.0" 298 | } 299 | }, 300 | "safe-buffer": { 301 | "version": "5.1.2", 302 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 303 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 304 | }, 305 | "safer-buffer": { 306 | "version": "2.1.2", 307 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 308 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 309 | }, 310 | "send": { 311 | "version": "0.17.1", 312 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", 313 | "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", 314 | "requires": { 315 | "debug": "2.6.9", 316 | "depd": "~1.1.2", 317 | "destroy": "~1.0.4", 318 | "encodeurl": "~1.0.2", 319 | "escape-html": "~1.0.3", 320 | "etag": "~1.8.1", 321 | "fresh": "0.5.2", 322 | "http-errors": "~1.7.2", 323 | "mime": "1.6.0", 324 | "ms": "2.1.1", 325 | "on-finished": "~2.3.0", 326 | "range-parser": "~1.2.1", 327 | "statuses": "~1.5.0" 328 | }, 329 | "dependencies": { 330 | "ms": { 331 | "version": "2.1.1", 332 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 333 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" 334 | } 335 | } 336 | }, 337 | "serve-static": { 338 | "version": "1.14.1", 339 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", 340 | "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", 341 | "requires": { 342 | "encodeurl": "~1.0.2", 343 | "escape-html": "~1.0.3", 344 | "parseurl": "~1.3.3", 345 | "send": "0.17.1" 346 | } 347 | }, 348 | "setprototypeof": { 349 | "version": "1.1.1", 350 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", 351 | "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" 352 | }, 353 | "statuses": { 354 | "version": "1.5.0", 355 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 356 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 357 | }, 358 | "toidentifier": { 359 | "version": "1.0.0", 360 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", 361 | "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" 362 | }, 363 | "type-is": { 364 | "version": "1.6.18", 365 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 366 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 367 | "requires": { 368 | "media-typer": "0.3.0", 369 | "mime-types": "~2.1.24" 370 | } 371 | }, 372 | "unpipe": { 373 | "version": "1.0.0", 374 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 375 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 376 | }, 377 | "utils-merge": { 378 | "version": "1.0.1", 379 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 380 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 381 | }, 382 | "uuid": { 383 | "version": "8.3.2", 384 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", 385 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" 386 | }, 387 | "vary": { 388 | "version": "1.1.2", 389 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 390 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 391 | } 392 | } 393 | } 394 | -------------------------------------------------------------------------------- /backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "backend", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "server.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node server.js" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "cors": "^2.8.5", 15 | "express": "^4.17.1", 16 | "uuid": "^8.3.2" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /backend/server.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const app = express(); 3 | const cors = require('cors'); 4 | const {v4: uuidv4} = require('uuid'); 5 | const {readFile, writeFile} = require('fs').promises; 6 | 7 | app.use(cors()); 8 | app.use(express.urlencoded({extended: false})); 9 | app.use(express.json()); 10 | 11 | let items = []; 12 | 13 | app.get('/', (req, res) => { 14 | res.send('Servidor de prueba'); 15 | }); 16 | app.get('/items', async (req, res) => { 17 | await open(); 18 | res.json(items); 19 | }); 20 | app.get('/items/:id', (req, res) => { 21 | res.send(`${req.params.id}`); 22 | }); 23 | app.put('/items/:id', async (req, res) => { 24 | const id = req.params.id; 25 | await open(); 26 | const index = items.findIndex(item => item.id === id); 27 | items[index].completed = !items[index].completed; 28 | await save(); 29 | res.json(items[index]); 30 | }); 31 | app.delete('/items/:id', async (req, res) => { 32 | const id = req.params.id; 33 | await open(); 34 | items = items.filter(item => item.id !== id); 35 | await save(); 36 | res.json(items); 37 | }); 38 | 39 | app.post('/items', async (req, res) => { 40 | const id = uuidv4(); 41 | req.body['id'] = id; 42 | await open(); 43 | items.unshift(req.body); 44 | 45 | await save(); 46 | res.json(req.body); 47 | }); 48 | 49 | async function save(){ 50 | const res = await writeFile('data.json', JSON.stringify(items), 'utf-8'); 51 | } 52 | 53 | async function open(){ 54 | const res = await readFile('data.json', 'utf-8'); 55 | items = JSON.parse(res); 56 | console.log('open',items); 57 | } 58 | 59 | 60 | 61 | 62 | app.listen(3000, () => { 63 | console.log('servidor iniciado...'); 64 | }); -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ 31 | spec: { 32 | displayStacktrace: StacktraceOption.PRETTY 33 | } 34 | })); 35 | } 36 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('angular-todos app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo(): Promise { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/angular-todos'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular-todos", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~10.2.0", 15 | "@angular/common": "~10.2.0", 16 | "@angular/compiler": "~10.2.0", 17 | "@angular/core": "~10.2.0", 18 | "@angular/forms": "~10.2.0", 19 | "@angular/platform-browser": "~10.2.0", 20 | "@angular/platform-browser-dynamic": "~10.2.0", 21 | "@angular/router": "~10.2.0", 22 | "rxjs": "~6.6.0", 23 | "tslib": "^2.0.0", 24 | "zone.js": "~0.10.2" 25 | }, 26 | "devDependencies": { 27 | "@angular-devkit/build-angular": "~0.1002.0", 28 | "@angular/cli": "~10.2.0", 29 | "@angular/compiler-cli": "~10.2.0", 30 | "@types/node": "^12.11.1", 31 | "@types/jasmine": "~3.5.0", 32 | "@types/jasminewd2": "~2.0.3", 33 | "codelyzer": "^6.0.0", 34 | "jasmine-core": "~3.6.0", 35 | "jasmine-spec-reporter": "~5.0.0", 36 | "karma": "~5.0.0", 37 | "karma-chrome-launcher": "~3.1.0", 38 | "karma-coverage-istanbul-reporter": "~3.0.2", 39 | "karma-jasmine": "~4.0.0", 40 | "karma-jasmine-html-reporter": "^1.5.0", 41 | "protractor": "~7.0.0", 42 | "ts-node": "~8.3.0", 43 | "tslint": "~6.1.0", 44 | "typescript": "~4.0.2" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes, RouterModule } from '@angular/router'; 3 | import {ItemsComponent} from './../app/components/items/items.component'; 4 | import {AddItemComponent} from './components/add-item/add-item.component'; 5 | 6 | const routes: Routes = [ 7 | { 8 | path: '', 9 | component: ItemsComponent 10 | }, 11 | { 12 | path:'add', 13 | component: AddItemComponent 14 | } 15 | ]; 16 | 17 | @NgModule({ 18 | imports: [RouterModule.forRoot(routes)], 19 | exports: [RouterModule] 20 | }) 21 | export class AppRoutingModule { } 22 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcosrivasr/angular-app/5c0c519fa529ff6db5d03e698339a72504ba8e81/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 |
-------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | title = 'angular-todos'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import {HttpClientModule} from '@angular/common/http'; 4 | import {FormsModule} from '@angular/forms'; 5 | 6 | import { AppRoutingModule } from './app-routing.module'; 7 | import { AppComponent } from './app.component'; 8 | import { ItemsComponent } from './components/items/items.component'; 9 | import { ShoppingItemComponent } from './components/shopping-item/shopping-item.component'; 10 | import { AddItemComponent } from './components/add-item/add-item.component'; 11 | import { HeaderComponent } from './components/header/header.component'; 12 | import { TotalComponent } from './components/total/total.component'; 13 | 14 | 15 | @NgModule({ 16 | declarations: [ 17 | AppComponent, 18 | ItemsComponent, 19 | ShoppingItemComponent, 20 | AddItemComponent, 21 | HeaderComponent, 22 | TotalComponent 23 | ], 24 | imports: [ 25 | BrowserModule, 26 | AppRoutingModule, 27 | HttpClientModule, 28 | FormsModule 29 | ], 30 | providers: [], 31 | bootstrap: [AppComponent] 32 | }) 33 | export class AppModule { } 34 | -------------------------------------------------------------------------------- /src/app/components/add-item/add-item.component.css: -------------------------------------------------------------------------------- 1 | form{ 2 | margin: 0 auto; 3 | width: 300px; 4 | display: block; 5 | } 6 | form div{ 7 | padding: 5px 0; 8 | } 9 | 10 | form label{ 11 | display: block; 12 | padding: 10px 0; 13 | } 14 | form input[type=text]{ 15 | width: 100%; 16 | padding: 5px; 17 | } -------------------------------------------------------------------------------- /src/app/components/add-item/add-item.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Registrar un nuevo artículo

3 |
4 | 5 | 6 |
7 | 8 |
9 | 10 | 11 |
12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /src/app/components/add-item/add-item.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, EventEmitter, OnInit, Output } from '@angular/core'; 2 | import {Router} from '@angular/router'; 3 | import { Item } from 'src/app/models/Item'; 4 | import {ItemService} from '../../services/item.service'; 5 | 6 | @Component({ 7 | selector: 'app-add-item', 8 | templateUrl: './add-item.component.html', 9 | styleUrls: ['./add-item.component.css'] 10 | }) 11 | export class AddItemComponent implements OnInit { 12 | 13 | title:string; 14 | price:number; 15 | quantity: number; 16 | @Output() addItem:EventEmitter = new EventEmitter(); 17 | 18 | constructor(private router:Router, private itemService:ItemService) { } 19 | 20 | ngOnInit(): void { 21 | 22 | } 23 | 24 | onSubmit(){ 25 | const item = new Item(); 26 | item.title = this.title; 27 | item.price = this.price; 28 | item.quantity = this.quantity; 29 | item.completed = false; 30 | 31 | this.itemService.addItem(item).subscribe(i => { 32 | this.router.navigate(['/']); 33 | }); 34 | 35 | /* this.addItem.emit(item); 36 | this.router.navigate(['/']); */ 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/app/components/header/header.component.css: -------------------------------------------------------------------------------- 1 | menu{ 2 | background: rgb(23, 55, 160); 3 | padding: 0; 4 | margin: 0; 5 | } 6 | menu ul{ 7 | display: flex; 8 | margin: 0; 9 | padding: 0; 10 | list-style: none; 11 | } 12 | menu ul li a{ 13 | display: block; 14 | color: white; 15 | text-decoration: none; 16 | padding: 10px 15px; 17 | } -------------------------------------------------------------------------------- /src/app/components/header/header.component.html: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /src/app/components/header/header.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-header', 5 | templateUrl: './header.component.html', 6 | styleUrls: ['./header.component.css'] 7 | }) 8 | export class HeaderComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/components/items/items.component.css: -------------------------------------------------------------------------------- 1 | #main-container{ 2 | width: 800px; 3 | margin: 0 auto; 4 | } 5 | 6 | @media screen and (max-width: 800px){ 7 | #main-container{ 8 | width: 100%; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/app/components/items/items.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 8 | 9 |
10 | -------------------------------------------------------------------------------- /src/app/components/items/items.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; 2 | import { Item } from '../../models/Item'; 3 | import { ItemService } from '../../services/item.service'; 4 | 5 | @Component({ 6 | selector: 'app-items', 7 | templateUrl: './items.component.html', 8 | styleUrls: ['./items.component.css'] 9 | }) 10 | export class ItemsComponent implements OnInit { 11 | 12 | items: Item[]; 13 | total:number = 0; 14 | constructor(private itemService:ItemService) { } 15 | 16 | ngOnInit(): void { 17 | 18 | /* this.items = [ 19 | { 20 | id: 0, 21 | title: 'manzana', 22 | price: 20, 23 | quantity: 4, 24 | completed: false 25 | }, 26 | { 27 | id: 0, 28 | title: 'leche', 29 | price: 20, 30 | quantity: 4, 31 | completed: true 32 | } 33 | ];*/ 34 | 35 | //this.items = this.itemService.getItems(); 36 | this.itemService.getItems().subscribe(items => { 37 | this.items = items; 38 | this.getTotal(); 39 | }); 40 | } 41 | 42 | deleteItem(item: Item){ 43 | this.items = this.items.filter(i => i.id != item.id); 44 | this.itemService.deleteItem(item).subscribe(); 45 | this.getTotal(); 46 | } 47 | 48 | addItem(item:Item){ 49 | console.log(item); 50 | this.itemService.addItem(item).subscribe(i => { 51 | this.items.unshift(i); 52 | this.getTotal(); 53 | }); 54 | } 55 | 56 | toggleItem(item:Item){ 57 | this.itemService.toggleCompleted(item).subscribe(i => {}) 58 | this.getTotal(); 59 | } 60 | 61 | getTotal(){ 62 | this.total = this.items 63 | .filter(item => item.completed === false) 64 | .map(item => item.price * item.quantity) 65 | .reduce((acc, item) => acc += item, 0); 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/app/components/shopping-item/shopping-item.component.css: -------------------------------------------------------------------------------- 1 | .row{ 2 | box-sizing: border-box; 3 | display: flex; 4 | align-items: center; 5 | } 6 | .row:hover{ 7 | border-radius: 3px; 8 | background: #eee; 9 | } 10 | div{ 11 | padding: 5px 0; 12 | } 13 | .completed{ 14 | color: #ddd; 15 | text-decoration: line-through; 16 | } 17 | .title{ 18 | display: flex; 19 | width: 50%; 20 | padding: 0 5px; 21 | } 22 | .price{ 23 | width: 15%; 24 | padding: 0 5px; 25 | } 26 | .quantity{ 27 | width: 10%; 28 | padding: 0 5px; 29 | } 30 | .completed .total{ 31 | color: #ddd; 32 | } 33 | .total{ 34 | width: 15%; 35 | font-weight: bolder; 36 | color: green; 37 | padding: 0 5px; 38 | } 39 | .actions{ 40 | width: 10%; 41 | text-align: center; 42 | box-sizing: border-box; 43 | padding: 0 5px; 44 | } 45 | .actions button{ 46 | border: none; 47 | font-size: 12px; 48 | background-color: red; 49 | color: white; 50 | padding: 5px; 51 | width: 100%; 52 | box-sizing: border-box; 53 | } 54 | .actions button:hover{ 55 | background-color: darkred; 56 | } 57 | 58 | @media screen and (max-width: 480px){ 59 | 60 | .title{ 61 | min-width: 30%; 62 | } 63 | .price, .total{ 64 | min-width: 15%; 65 | font-size: 12px; 66 | } 67 | .quantity{ 68 | min-width: 5%; 69 | font-size: 12px; 70 | } 71 | 72 | .actions{ 73 | width: 20%; 74 | font-size: 10px; 75 | } 76 | } -------------------------------------------------------------------------------- /src/app/components/shopping-item/shopping-item.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | {{item.title}} 5 |
6 |
7 | {{item.price | currency}} 8 |
9 |
10 | {{item.quantity}} 11 |
12 |
13 | {{(item.price * item.quantity) | currency}} 14 |
15 |
16 | 17 |
18 |
-------------------------------------------------------------------------------- /src/app/components/shopping-item/shopping-item.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit, EventEmitter, Output } from '@angular/core'; 2 | import { Item } from 'src/app/models/Item'; 3 | import {ItemService } from '../../services/item.service'; 4 | 5 | @Component({ 6 | selector: 'app-shopping-item', 7 | templateUrl: './shopping-item.component.html', 8 | styleUrls: ['./shopping-item.component.css'] 9 | }) 10 | export class ShoppingItemComponent implements OnInit { 11 | 12 | @Input() item:Item; 13 | @Output() deleteItem: EventEmitter = new EventEmitter(); 14 | @Output() toggleItem: EventEmitter = new EventEmitter(); 15 | 16 | constructor(private itemService:ItemService) { } 17 | 18 | ngOnInit(): void { 19 | } 20 | 21 | setClasses(){ 22 | let classes = { 23 | item: true, 24 | 'completed': this.item.completed 25 | }; 26 | 27 | return classes; 28 | } 29 | 30 | onToggle(item){ 31 | item.completed = !item.completed; 32 | /* this.itemService.toggleCompleted(item).subscribe(item => { 33 | 34 | }); */ 35 | this.toggleItem.emit(item); 36 | } 37 | 38 | onDelete(item){ 39 | this.deleteItem.emit(item); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/app/components/total/total.component.css: -------------------------------------------------------------------------------- 1 | .container{ 2 | text-align: center; 3 | padding: 10px 0; 4 | } 5 | 6 | h2{ 7 | margin: 0; 8 | } -------------------------------------------------------------------------------- /src/app/components/total/total.component.html: -------------------------------------------------------------------------------- 1 |
2 | {{mensaje}} 3 |

{{total | currency}}

4 |
-------------------------------------------------------------------------------- /src/app/components/total/total.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, Input, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-total', 5 | templateUrl: './total.component.html', 6 | styleUrls: ['./total.component.css'] 7 | }) 8 | export class TotalComponent implements OnInit { 9 | 10 | @Input() total:number = 0; 11 | @Input() mensaje:string = ''; 12 | 13 | constructor() { } 14 | 15 | ngOnInit(): void { 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/app/models/Item.ts: -------------------------------------------------------------------------------- 1 | 2 | export class Item{ 3 | id: number; 4 | title: string; 5 | price: number; 6 | quantity: number; 7 | completed: boolean; 8 | } -------------------------------------------------------------------------------- /src/app/services/item.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import {HttpClient, HttpHeaders} from '@angular/common/http'; 3 | import {Item} from '../models/Item'; 4 | import {Observable} from 'rxjs'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class ItemService { 10 | 11 | private url = 'http://localhost:3000/items/'; 12 | private httpOptions = { 13 | headers: { 14 | 'Content-Type': 'application/json' 15 | } 16 | }; 17 | 18 | constructor(private http:HttpClient) { } 19 | 20 | 21 | /* getItems(){ 22 | return [ 23 | { 24 | id: 0, 25 | title: 'manzana', 26 | price: 20, 27 | quantity: 4, 28 | completed: false 29 | }, 30 | { 31 | id: 0, 32 | title: 'leche', 33 | price: 20, 34 | quantity: 4, 35 | completed: true 36 | }, 37 | { 38 | id: 0, 39 | title: 'leche', 40 | price: 20, 41 | quantity: 4, 42 | completed: true 43 | } 44 | ]; 45 | } */ 46 | getItems():Observable{ 47 | return this.http.get(this.url); 48 | } 49 | 50 | toggleCompleted(item:Item):Observable{ 51 | return this.http.put(this.url + item.id,item, this.httpOptions); 52 | } 53 | 54 | deleteItem(item:Item):Observable{ 55 | return this.http.delete(this.url + item.id); 56 | } 57 | 58 | addItem(item:Item):Observable{ 59 | return this.http.post(this.url, item, this.httpOptions); 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcosrivasr/angular-app/5c0c519fa529ff6db5d03e698339a72504ba8e81/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcosrivasr/angular-app/5c0c519fa529ff6db5d03e698339a72504ba8e81/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AngularTodos 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | body{ 3 | font-family: Arial, Helvetica, sans-serif; 4 | padding: 0; 5 | margin: 0; 6 | } 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "sourceMap": true, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "module": "es2020", 15 | "lib": [ 16 | "es2018", 17 | "dom" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "align": { 8 | "options": [ 9 | "parameters", 10 | "statements" 11 | ] 12 | }, 13 | "array-type": false, 14 | "arrow-return-shorthand": true, 15 | "curly": true, 16 | "deprecation": { 17 | "severity": "warning" 18 | }, 19 | "eofline": true, 20 | "import-blacklist": [ 21 | true, 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": { 26 | "options": [ 27 | "spaces" 28 | ] 29 | }, 30 | "max-classes-per-file": false, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-console": [ 47 | true, 48 | "debug", 49 | "info", 50 | "time", 51 | "timeEnd", 52 | "trace" 53 | ], 54 | "no-empty": false, 55 | "no-inferrable-types": [ 56 | true, 57 | "ignore-params" 58 | ], 59 | "no-non-null-assertion": true, 60 | "no-redundant-jsdoc": true, 61 | "no-switch-case-fall-through": true, 62 | "no-var-requires": false, 63 | "object-literal-key-quotes": [ 64 | true, 65 | "as-needed" 66 | ], 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "semicolon": { 72 | "options": [ 73 | "always" 74 | ] 75 | }, 76 | "space-before-function-paren": { 77 | "options": { 78 | "anonymous": "never", 79 | "asyncArrow": "always", 80 | "constructor": "never", 81 | "method": "never", 82 | "named": "never" 83 | } 84 | }, 85 | "typedef": [ 86 | true, 87 | "call-signature" 88 | ], 89 | "typedef-whitespace": { 90 | "options": [ 91 | { 92 | "call-signature": "nospace", 93 | "index-signature": "nospace", 94 | "parameter": "nospace", 95 | "property-declaration": "nospace", 96 | "variable-declaration": "nospace" 97 | }, 98 | { 99 | "call-signature": "onespace", 100 | "index-signature": "onespace", 101 | "parameter": "onespace", 102 | "property-declaration": "onespace", 103 | "variable-declaration": "onespace" 104 | } 105 | ] 106 | }, 107 | "variable-name": { 108 | "options": [ 109 | "ban-keywords", 110 | "check-format", 111 | "allow-pascal-case" 112 | ] 113 | }, 114 | "whitespace": { 115 | "options": [ 116 | "check-branch", 117 | "check-decl", 118 | "check-operator", 119 | "check-separator", 120 | "check-type", 121 | "check-typecast" 122 | ] 123 | }, 124 | "component-class-suffix": true, 125 | "contextual-lifecycle": true, 126 | "directive-class-suffix": true, 127 | "no-conflicting-lifecycle": true, 128 | "no-host-metadata-property": true, 129 | "no-input-rename": true, 130 | "no-inputs-metadata-property": true, 131 | "no-output-native": true, 132 | "no-output-on-prefix": true, 133 | "no-output-rename": true, 134 | "no-outputs-metadata-property": true, 135 | "template-banana-in-box": true, 136 | "template-no-negated-async": true, 137 | "use-lifecycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "directive-selector": [ 140 | true, 141 | "attribute", 142 | "app", 143 | "camelCase" 144 | ], 145 | "component-selector": [ 146 | true, 147 | "element", 148 | "app", 149 | "kebab-case" 150 | ] 151 | } 152 | } 153 | --------------------------------------------------------------------------------