├── .browserslistrc ├── .editorconfig ├── .gitignore ├── .vscode ├── extensions.json └── launch.json ├── README.md ├── angular.json ├── 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.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── menu │ │ ├── menu.component.css │ │ ├── menu.component.html │ │ ├── menu.component.spec.ts │ │ └── menu.component.ts │ ├── shared │ │ ├── classes │ │ │ ├── usuario.spec.ts │ │ │ └── usuario.ts │ │ ├── interfaces │ │ │ └── entrada.ts │ │ └── services │ │ │ ├── entrada.service.spec.ts │ │ │ ├── entrada.service.ts │ │ │ ├── login.service.spec.ts │ │ │ └── login.service.ts │ └── views │ │ ├── acerca-de-nosotros │ │ ├── acerca-de-nosotros.component.css │ │ ├── acerca-de-nosotros.component.html │ │ ├── acerca-de-nosotros.component.spec.ts │ │ └── acerca-de-nosotros.component.ts │ │ ├── listado │ │ ├── entrada │ │ │ ├── entrada.component.css │ │ │ ├── entrada.component.html │ │ │ ├── entrada.component.spec.ts │ │ │ └── entrada.component.ts │ │ ├── listado.component.css │ │ ├── listado.component.html │ │ ├── listado.component.spec.ts │ │ └── listado.component.ts │ │ ├── login │ │ ├── login.component.css │ │ ├── login.component.html │ │ ├── login.component.spec.ts │ │ └── login.component.ts │ │ └── pagina-no-encontrada │ │ ├── pagina-no-encontrada.component.css │ │ ├── pagina-no-encontrada.component.html │ │ ├── pagina-no-encontrada.component.spec.ts │ │ └── pagina-no-encontrada.component.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 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /.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 | 48 | # Angular 49 | .angulardoc.json 50 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "johnpapa.angular-essentials", 4 | "cyrilletuzi.angular-schematics", 5 | "steoates.autoimport", 6 | "formulahendry.auto-rename-tag", 7 | "coenraads.bracket-pair-colorizer-2", 8 | "eamodio.gitlens", 9 | "abusaidm.html-snippets", 10 | "davidanson.vscode-markdownlint", 11 | "christian-kohler.npm-intellisense", 12 | "quicktype.quicktype", 13 | "christian-kohler.path-intellisense", 14 | "meganrogge.template-string-converter", 15 | "visualstudioexptteam.vscodeintellicode", 16 | "vscode-icons-team.vscode-icons" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Launch Chrome", 9 | "request": "launch", 10 | "type": "pwa-chrome", 11 | "url": "http://localhost:4201", 12 | "webRoot": "${workspaceFolder}" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CursoAngularOpenWebinar 2 | 3 | Este proyecto ha sido generado con [Angular CLI](https://github.com/angular/angular-cli) en la versión 11.0.6 4 | 5 | > ng new cursoAngularOpenWebinar 6 | 7 | ## Servidor de desarrollo 8 | 9 | Para poder ejecutar nuestra aplicación en nuestro navegador y trabajar con ella ejecutaremos el comando `ng serve`. Una vez levantado el servidor navegaremos a la ruta por defecto `http://localhost:4200/`. Si realizamos cambios en los archivos de nuestro proyecto, automáticamente se reiniciará el servidor y volverá a cargar la aplicación. 10 | 11 | Otros comandos útiles son: 12 | 13 | > ng serve --open # Para abrir automáticamente la aplicación en el navegador por defecto 14 | 15 | > ng serve -o # Equivale al *--open* 16 | 17 | > ng serve --port 4205 # Para cambiar el puerto por defecto 18 | 19 | > ng serve --open --port 4205 # Podremos combinar varios parámetros a la vez con *ng serve* 20 | 21 | ## Generando código 22 | 23 | Ejecuta `ng generate component component-name` para crear un nuevo componente. Este comando también se puede utilizar para: `ng generate directive|pipe|service|class|guard|interface|enum|module`. 24 | 25 | ## Build 26 | 27 | Ejecuta `ng build` para compilar nuestro proyecto. Estos archivos se guardarán por defecto en la carpeta `dist/`. Usarémos el parámetro `--prod` para compilar nuestra versión de producción. 28 | 29 | ## Ayuda 30 | 31 | Para más información de Angular CLI puedes usar `ng help` o visitar la web de [Angular CLI](https://angular.io/cli). 32 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "cursoAngularOpenWebinar": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:application": { 10 | "strict": true 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/cursoAngularOpenWebinar", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": true, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "src/styles.css" 32 | ], 33 | "scripts": [] 34 | }, 35 | "configurations": { 36 | "production": { 37 | "fileReplacements": [ 38 | { 39 | "replace": "src/environments/environment.ts", 40 | "with": "src/environments/environment.prod.ts" 41 | } 42 | ], 43 | "optimization": true, 44 | "outputHashing": "all", 45 | "sourceMap": false, 46 | "namedChunks": false, 47 | "extractLicenses": true, 48 | "vendorChunk": false, 49 | "buildOptimizer": true, 50 | "budgets": [ 51 | { 52 | "type": "initial", 53 | "maximumWarning": "500kb", 54 | "maximumError": "1mb" 55 | }, 56 | { 57 | "type": "anyComponentStyle", 58 | "maximumWarning": "2kb", 59 | "maximumError": "4kb" 60 | } 61 | ] 62 | } 63 | } 64 | }, 65 | "serve": { 66 | "builder": "@angular-devkit/build-angular:dev-server", 67 | "options": { 68 | "browserTarget": "cursoAngularOpenWebinar:build" 69 | }, 70 | "configurations": { 71 | "production": { 72 | "browserTarget": "cursoAngularOpenWebinar:build:production" 73 | } 74 | } 75 | }, 76 | "extract-i18n": { 77 | "builder": "@angular-devkit/build-angular:extract-i18n", 78 | "options": { 79 | "browserTarget": "cursoAngularOpenWebinar:build" 80 | } 81 | }, 82 | "test": { 83 | "builder": "@angular-devkit/build-angular:karma", 84 | "options": { 85 | "main": "src/test.ts", 86 | "polyfills": "src/polyfills.ts", 87 | "tsConfig": "tsconfig.spec.json", 88 | "karmaConfig": "karma.conf.js", 89 | "assets": [ 90 | "src/favicon.ico", 91 | "src/assets" 92 | ], 93 | "styles": [ 94 | "src/styles.css" 95 | ], 96 | "scripts": [] 97 | } 98 | }, 99 | "lint": { 100 | "builder": "@angular-devkit/build-angular:tslint", 101 | "options": { 102 | "tsConfig": [ 103 | "tsconfig.app.json", 104 | "tsconfig.spec.json", 105 | "e2e/tsconfig.json" 106 | ], 107 | "exclude": [ 108 | "**/node_modules/**" 109 | ] 110 | } 111 | }, 112 | "e2e": { 113 | "builder": "@angular-devkit/build-angular:protractor", 114 | "options": { 115 | "protractorConfig": "e2e/protractor.conf.js", 116 | "devServerTarget": "cursoAngularOpenWebinar:serve" 117 | }, 118 | "configurations": { 119 | "production": { 120 | "devServerTarget": "cursoAngularOpenWebinar:serve:production" 121 | } 122 | } 123 | } 124 | } 125 | } 126 | }, 127 | "defaultProject": "cursoAngularOpenWebinar" 128 | } 129 | -------------------------------------------------------------------------------- /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 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; -------------------------------------------------------------------------------- /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', async () => { 12 | await page.navigateTo(); 13 | expect(await page.getTitleText()).toEqual('cursoAngularOpenWebinar 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 | async navigateTo(): Promise { 5 | return browser.get(browser.baseUrl); 6 | } 7 | 8 | async getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText(); 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 | "node" 11 | ] 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/cursoAngularOpenWebinar'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "curso-angular-open-webinar", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve --port 4205", 7 | "start:open": "ng serve --port 4205 -o", 8 | "build": "ng build", 9 | "build:prod": "ng build --prod", 10 | "test": "ng test", 11 | "lint": "ng lint", 12 | "e2e": "ng e2e" 13 | }, 14 | "private": true, 15 | "dependencies": { 16 | "@angular/animations": "~11.0.6", 17 | "@angular/common": "~11.0.6", 18 | "@angular/compiler": "~11.0.6", 19 | "@angular/core": "~11.0.6", 20 | "@angular/forms": "~11.0.6", 21 | "@angular/platform-browser": "~11.0.6", 22 | "@angular/platform-browser-dynamic": "~11.0.6", 23 | "@angular/router": "~11.0.6", 24 | "rxjs": "~6.6.0", 25 | "tslib": "^2.0.0", 26 | "zone.js": "~0.10.2" 27 | }, 28 | "devDependencies": { 29 | "@angular-devkit/build-angular": "~0.1100.6", 30 | "@angular/cli": "~11.0.6", 31 | "@angular/compiler-cli": "~11.0.6", 32 | "@types/jasmine": "~3.6.0", 33 | "@types/node": "^12.11.1", 34 | "codelyzer": "^6.0.0", 35 | "jasmine-core": "~3.6.0", 36 | "jasmine-spec-reporter": "~5.0.0", 37 | "karma": "~5.1.0", 38 | "karma-chrome-launcher": "~3.1.0", 39 | "karma-coverage": "~2.0.3", 40 | "karma-jasmine": "~4.0.0", 41 | "karma-jasmine-html-reporter": "^1.5.0", 42 | "protractor": "~7.0.0", 43 | "ts-node": "~8.3.0", 44 | "tslint": "~6.1.0", 45 | "typescript": "~4.0.2" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | 4 | import { ListadoComponent } from './views/listado/listado.component'; 5 | import { AcercaDeNosotrosComponent } from './views/acerca-de-nosotros/acerca-de-nosotros.component'; 6 | import { PaginaNoEncontradaComponent } from './views/pagina-no-encontrada/pagina-no-encontrada.component'; 7 | import { LoginComponent } from './views/login/login.component'; 8 | 9 | 10 | const routes: Routes = [ 11 | { path: 'listado', component: ListadoComponent }, 12 | { path: 'nosotros', component: AcercaDeNosotrosComponent}, 13 | { path: 'login', component: LoginComponent}, 14 | 15 | { path: '', redirectTo: '/listado', pathMatch: 'full'}, 16 | { path: '**', component: PaginaNoEncontradaComponent} 17 | ]; 18 | 19 | @NgModule({ 20 | exports: [RouterModule], 21 | imports: [RouterModule.forRoot(routes)] 22 | }) 23 | export class AppRoutingModule { } 24 | -------------------------------------------------------------------------------- /src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenWebinarsNet/cursoAngularOpenWebinar/c923507be6924ffd5795e6d09b92237ee0b97180/src/app/app.component.css -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 |

Curso Desarrollo web con Angular, OpenWebinar

2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | 4 | describe('AppComponent', () => { 5 | beforeEach(async () => { 6 | await TestBed.configureTestingModule({ 7 | declarations: [ 8 | AppComponent 9 | ], 10 | }).compileComponents(); 11 | }); 12 | 13 | it('should create the app', () => { 14 | const fixture = TestBed.createComponent(AppComponent); 15 | const app = fixture.componentInstance; 16 | expect(app).toBeTruthy(); 17 | }); 18 | 19 | it(`should have as title 'cursoAngularOpenWebinar'`, () => { 20 | const fixture = TestBed.createComponent(AppComponent); 21 | const app = fixture.componentInstance; 22 | expect(app.title).toEqual('cursoAngularOpenWebinar'); 23 | }); 24 | 25 | it('should render title', () => { 26 | const fixture = TestBed.createComponent(AppComponent); 27 | fixture.detectChanges(); 28 | const compiled = fixture.nativeElement; 29 | expect(compiled.querySelector('.content span').textContent).toContain('cursoAngularOpenWebinar app is running!'); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /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 = 'cursoAngularOpenWebinar'; 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { FormsModule } from '@angular/forms'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { NgModule } from '@angular/core'; 4 | import { HttpClientModule } from '@angular/common/http'; 5 | 6 | import { AppComponent } from './app.component'; 7 | import { MenuComponent } from './menu/menu.component'; 8 | import { ListadoComponent } from './views/listado/listado.component'; 9 | import { EntradaComponent } from './views/listado/entrada/entrada.component'; 10 | import { AppRoutingModule } from './app-routing.module'; 11 | import { PaginaNoEncontradaComponent } from './views/pagina-no-encontrada/pagina-no-encontrada.component'; 12 | import { AcercaDeNosotrosComponent } from './views/acerca-de-nosotros/acerca-de-nosotros.component'; 13 | import { LoginComponent } from './views/login/login.component'; 14 | 15 | @NgModule({ 16 | declarations: [ 17 | AppComponent, 18 | MenuComponent, 19 | ListadoComponent, 20 | EntradaComponent, 21 | PaginaNoEncontradaComponent, 22 | AcercaDeNosotrosComponent, 23 | LoginComponent 24 | ], 25 | imports: [ 26 | BrowserModule, 27 | AppRoutingModule, 28 | HttpClientModule, 29 | FormsModule 30 | ], 31 | providers: [], 32 | bootstrap: [AppComponent] 33 | }) 34 | export class AppModule { } 35 | -------------------------------------------------------------------------------- /src/app/menu/menu.component.css: -------------------------------------------------------------------------------- 1 | #menu { 2 | padding: 0; 3 | background-color: rgb(255, 221, 158); 4 | width: 100%; 5 | height: 40px; 6 | } 7 | 8 | #menu li { 9 | display: inline; 10 | } 11 | 12 | #menu li span { 13 | font-family: Arial; 14 | float: left; 15 | padding: 10px; 16 | } 17 | 18 | #acceso { 19 | position: absolute; 20 | right: 10px; 21 | } 22 | -------------------------------------------------------------------------------- /src/app/menu/menu.component.html: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /src/app/menu/menu.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MenuComponent } from './menu.component'; 4 | 5 | describe('MenuComponent', () => { 6 | let component: MenuComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ MenuComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MenuComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/menu/menu.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-menu', 5 | templateUrl: './menu.component.html', 6 | styleUrls: ['./menu.component.css'] 7 | }) 8 | export class MenuComponent implements OnInit { 9 | 10 | public miToken: number; 11 | public nombreUsuario: string | null; 12 | 13 | constructor() { 14 | this.miToken = 0; 15 | this.nombreUsuario = ""; 16 | } 17 | 18 | ngOnInit(): void { 19 | 20 | if (localStorage.getItem('miTokenPersonal')) { 21 | this.miToken = +localStorage.getItem('miTokenPersonal')!; 22 | } 23 | 24 | if (localStorage.getItem('miTokenPersonal')) { 25 | this.nombreUsuario = localStorage.getItem('nombreUsuario'); 26 | } 27 | 28 | } 29 | 30 | public logout(): void { 31 | if (localStorage.getItem('miTokenPersonal')) { 32 | localStorage.removeItem('miTokenPersonal'); 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/app/shared/classes/usuario.spec.ts: -------------------------------------------------------------------------------- 1 | import { Usuario } from './usuario'; 2 | 3 | describe('Usuario', () => { 4 | it('should create an instance', () => { 5 | expect(new Usuario()).toBeTruthy(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /src/app/shared/classes/usuario.ts: -------------------------------------------------------------------------------- 1 | export class Usuario { 2 | public nombre: string; 3 | public contrasegna: string; 4 | 5 | constructor() { 6 | this.nombre = ''; 7 | this.contrasegna = ''; 8 | } 9 | } 10 | 11 | /** Si no queréis que os salte el error de que debes de inicializar los atributos en el constructor añade este parámetro al tsconfig.json 12 | * en CompilerOptions 13 | * "strictPropertyInitialization": false 14 | */ 15 | -------------------------------------------------------------------------------- /src/app/shared/interfaces/entrada.ts: -------------------------------------------------------------------------------- 1 | export interface Entrada { 2 | userId: number; 3 | id: number; 4 | title: string; 5 | body: string; 6 | } 7 | -------------------------------------------------------------------------------- /src/app/shared/services/entrada.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { EntradaService } from './entrada.service'; 4 | 5 | describe('EntradaService', () => { 6 | let service: EntradaService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(EntradaService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/shared/services/entrada.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { HttpClient } from '@angular/common/http'; 3 | import { Observable } from 'rxjs'; 4 | 5 | import { Entrada } from '../interfaces/entrada'; 6 | 7 | @Injectable({ 8 | providedIn: 'root' 9 | }) 10 | export class EntradaService { 11 | 12 | constructor(private httpClient: HttpClient) { } 13 | 14 | public recuperarEntradas(): Observable { 15 | 16 | return this.httpClient.get('https://jsonplaceholder.typicode.com/posts'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/app/shared/services/login.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginService } from './login.service'; 4 | 5 | describe('LoginService', () => { 6 | let service: LoginService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(LoginService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /src/app/shared/services/login.service.ts: -------------------------------------------------------------------------------- 1 | import { Observable, of } from 'rxjs'; 2 | import { Injectable } from '@angular/core'; 3 | import { Usuario } from '../classes/usuario'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class LoginService { 9 | 10 | constructor() { } 11 | 12 | public login(usuario: Usuario): Observable { 13 | 14 | return of(Math.random() * (1000-0)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/app/views/acerca-de-nosotros/acerca-de-nosotros.component.css: -------------------------------------------------------------------------------- 1 | #contenedor * { 2 | padding: 5px; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/views/acerca-de-nosotros/acerca-de-nosotros.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Curo de Angular 11, OpenWebinar

3 | 4 |

Bienvenidos a este curso de Angular 11.

5 |
6 |

Este es el proyecto que se va a realizar para desarrollar nuestro curso de programación web. 7 | Espero que lo disfrutéis como yo lo he hecho realizandolo 8 | 9 | ¡Gracias! 10 |

11 |
12 | -------------------------------------------------------------------------------- /src/app/views/acerca-de-nosotros/acerca-de-nosotros.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AcercaDeNosotrosComponent } from './acerca-de-nosotros.component'; 4 | 5 | describe('AcercaDeNosotrosComponent', () => { 6 | let component: AcercaDeNosotrosComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AcercaDeNosotrosComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AcercaDeNosotrosComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/views/acerca-de-nosotros/acerca-de-nosotros.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-acerca-de-nosotros', 5 | templateUrl: './acerca-de-nosotros.component.html', 6 | styleUrls: ['./acerca-de-nosotros.component.css'] 7 | }) 8 | export class AcercaDeNosotrosComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/app/views/listado/entrada/entrada.component.css: -------------------------------------------------------------------------------- 1 | #entrada { 2 | background-color: aqua; 3 | border-radius: 10px; 4 | } 5 | 6 | #entrada * { 7 | padding: 10px; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/views/listado/entrada/entrada.component.html: -------------------------------------------------------------------------------- 1 |
2 |

{{ entrada.title }}

3 |

{{ entrada.body }}

4 |
5 | -------------------------------------------------------------------------------- /src/app/views/listado/entrada/entrada.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { EntradaComponent } from './entrada.component'; 4 | 5 | describe('EntradaComponent', () => { 6 | let component: EntradaComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ EntradaComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(EntradaComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/views/listado/entrada/entrada.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input } from '@angular/core'; 2 | 3 | import { Entrada } from 'src/app/shared/interfaces/entrada'; 4 | 5 | @Component({ 6 | selector: 'app-entrada', 7 | templateUrl: './entrada.component.html', 8 | styleUrls: ['./entrada.component.css'] 9 | }) 10 | export class EntradaComponent implements OnInit { 11 | // Atributos 12 | @Input() 13 | public entrada: Entrada; 14 | 15 | constructor() { 16 | this.entrada = { 17 | title: '', 18 | body: '', 19 | id: 1, 20 | userId: 1 21 | } 22 | } 23 | 24 | ngOnInit(): void { 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/app/views/listado/listado.component.css: -------------------------------------------------------------------------------- 1 | #listado { 2 | background-color: azure; 3 | height: 750px; 4 | } 5 | 6 | #listado h3 { 7 | padding: 10px; 8 | } 9 | -------------------------------------------------------------------------------- /src/app/views/listado/listado.component.html: -------------------------------------------------------------------------------- 1 |
2 |

Listado de entradas al blog:

3 | 4 |
5 | -------------------------------------------------------------------------------- /src/app/views/listado/listado.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ListadoComponent } from './listado.component'; 4 | 5 | describe('ListadoComponent', () => { 6 | let component: ListadoComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ ListadoComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ListadoComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/views/listado/listado.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | import { Entrada } from 'src/app/shared/interfaces/entrada'; 4 | import { EntradaService } from 'src/app/shared/services/entrada.service'; 5 | 6 | @Component({ 7 | selector: 'app-listado', 8 | templateUrl: './listado.component.html', 9 | styleUrls: ['./listado.component.css'] 10 | }) 11 | export class ListadoComponent implements OnInit { 12 | // Atibutos 13 | public listadoEntradas: Entrada[]; 14 | 15 | constructor(private entradaService: EntradaService) { 16 | this.listadoEntradas = [ ]; 17 | } 18 | 19 | ngOnInit(): void { 20 | 21 | this.listarEntradas(); 22 | } 23 | 24 | private listarEntradas(): void { 25 | 26 | this.entradaService.recuperarEntradas().subscribe( 27 | (entradas: Entrada[]) => { 28 | this.listadoEntradas = entradas; 29 | }, 30 | (error: Error) => { 31 | console.log('Error: ', error); 32 | }, 33 | () => { 34 | console.log('Petición realizada correctamente'); 35 | } 36 | ); 37 | } 38 | 39 | public mostrarTitulo(titulo: string): void { 40 | alert(`Entrada seleccionada: ${ titulo }.`); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/app/views/login/login.component.css: -------------------------------------------------------------------------------- 1 | .form { 2 | display: flex; 3 | justify-content: center; 4 | } 5 | 6 | form { 7 | padding: 10px; 8 | width: 50%; 9 | background-color: rgb(250, 228, 189); 10 | display: flex; 11 | flex-direction: column; 12 | } 13 | 14 | form * { 15 | padding: 5px; 16 | } 17 | 18 | .form-group { 19 | display: flex; 20 | flex-wrap: wrap; 21 | } 22 | 23 | .form-group label { 24 | width: 15%; 25 | } 26 | 27 | .form-group input { 28 | width: 85%; 29 | } 30 | 31 | button { 32 | margin-top: 20px; 33 | width: 100px; 34 | align-self: center; 35 | background-color: rgb(70, 70, 250); 36 | color: white; 37 | } 38 | 39 | .alert { 40 | background-color: red; 41 | color: white; 42 | width: 100%; 43 | margin: 10px; 44 | } 45 | -------------------------------------------------------------------------------- /src/app/views/login/login.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 7 |
8 |
Campo requerido
9 |
10 |
11 |
12 | 13 | 15 |
16 |
Campo requerido
17 |
Mínimo 4 caracteres
18 |
19 |
20 | 21 | 22 |
23 |
24 | 25 | -------------------------------------------------------------------------------- /src/app/views/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ LoginComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/views/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Router } from '@angular/router'; 3 | 4 | import { Usuario } from 'src/app/shared/classes/usuario'; 5 | import { LoginService } from 'src/app/shared/services/login.service'; 6 | 7 | @Component({ 8 | selector: 'app-login', 9 | templateUrl: './login.component.html', 10 | styleUrls: ['./login.component.css'] 11 | }) 12 | export class LoginComponent implements OnInit { 13 | // Atributos 14 | public usuario: Usuario 15 | 16 | constructor( 17 | private loginService: LoginService, 18 | private router: Router) { 19 | this.usuario = new Usuario(); 20 | } 21 | 22 | ngOnInit(): void { 23 | } 24 | 25 | public submit(): void { 26 | 27 | this.loginService.login(this.usuario).subscribe( 28 | (data: number) => { 29 | localStorage.setItem('nombreUsuario', this.usuario.nombre); 30 | localStorage.setItem('miTokenPersonal',`${ data }`); 31 | 32 | this.router.navigate(['/listado']); 33 | }, 34 | (error: Error) => { 35 | console.error("Error al realizar el acceso"); 36 | } 37 | ) 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/app/views/pagina-no-encontrada/pagina-no-encontrada.component.css: -------------------------------------------------------------------------------- 1 | h2 { 2 | padding: 10px; 3 | } 4 | -------------------------------------------------------------------------------- /src/app/views/pagina-no-encontrada/pagina-no-encontrada.component.html: -------------------------------------------------------------------------------- 1 |

¡Vaya! Parece que esta página no se encuentra disponible

2 | -------------------------------------------------------------------------------- /src/app/views/pagina-no-encontrada/pagina-no-encontrada.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PaginaNoEncontradaComponent } from './pagina-no-encontrada.component'; 4 | 5 | describe('PaginaNoEncontradaComponent', () => { 6 | let component: PaginaNoEncontradaComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ PaginaNoEncontradaComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PaginaNoEncontradaComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/views/pagina-no-encontrada/pagina-no-encontrada.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-pagina-no-encontrada', 5 | templateUrl: './pagina-no-encontrada.component.html', 6 | styleUrls: ['./pagina-no-encontrada.component.css'] 7 | }) 8 | export class PaginaNoEncontradaComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit(): void { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenWebinarsNet/cursoAngularOpenWebinar/c923507be6924ffd5795e6d09b92237ee0b97180/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/OpenWebinarsNet/cursoAngularOpenWebinar/c923507be6924ffd5795e6d09b92237ee0b97180/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CursoAngularOpenWebinar 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 | /** 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 | 3 | #contenedor { 4 | background-color: azure; 5 | height: 750px; 6 | } 7 | -------------------------------------------------------------------------------- /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 | "forceConsistentCasingInFileNames": true, 8 | "strict": true, 9 | "noImplicitReturns": true, 10 | "noFallthroughCasesInSwitch": true, 11 | "sourceMap": true, 12 | "declaration": false, 13 | "downlevelIteration": true, 14 | "experimentalDecorators": true, 15 | "moduleResolution": "node", 16 | "importHelpers": true, 17 | "target": "es2015", 18 | "module": "es2020", 19 | "lib": [ 20 | "es2018", 21 | "dom" 22 | ] 23 | }, 24 | "angularCompilerOptions": { 25 | "strictInjectionParameters": true, 26 | "strictInputAccessModifiers": true, 27 | "strictTemplates": true 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------