Skip to content

3 services #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
!.vscode/extensions.json

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -3,23 +3,13 @@

This repository contains the code of the [Angular Core Deep Dive](https://angular-university.io/course/angular-course).

This course repository is updated to Angular v6, and there is a package-lock.json file available, for avoiding semantic versioning installation issues.

![Angular Core Deep Dive](https://s3-us-west-1.amazonaws.com/angular-university/course-images/angular-core-in-depth-small.png)
This course repository is updated to Angular 20:

![Angular Core Deep Dive](https://d3vigmphadbn9b.cloudfront.net/course-images/large-images/angular-core-deep-dive-new-2.jpg)

# Installation pre-requisites

IMPORTANT: Please use the latest Node and especially NPM, to make sure the package-lock.json is used.

For running this project we need and npm installed on our machine. These are some tutorials to install node in different operating systems:

*Its important to install the latest version of Node*

- [Install Node and NPM on Windows](https://www.youtube.com/watch?v=8ODS6RM6x7g)
- [Install Node and NPM on Linux](https://www.youtube.com/watch?v=yUdHk-Dk_BY)
- [Install Node and NPM on Mac](https://www.youtube.com/watch?v=Imj8PgG3bZU)

IMPORTANT: Please use Node 22 LTS (Long Term Support version).

# Installing the Angular CLI

@@ -82,6 +72,12 @@ We can checkout the remote branch and start tracking it with a local branch that
It's also possible to download a ZIP file for a given branch, using the branch dropdown on this page on the top left, and then selecting the Clone or Download / Download as ZIP button.

# Other Courses
# Modern Angular With Signals

If you are looking for the [Modern Angular With Signals Course](https://angular-university.io/course/angular-signals-course), the repo with the full code can be found here:

![Modern Angular With Signals Course](https://d3vigmphadbn9b.cloudfront.net/course-images/large-images/angular-signals-course.jpg)


# RxJs In Practice Course

125 changes: 87 additions & 38 deletions angular.json
Original file line number Diff line number Diff line change
@@ -4,34 +4,62 @@
"newProjectRoot": "projects",
"projects": {
"angular-course": {
"i18n": {
"locales": {
"fr": {
"translation": "src/locale/messages.fr.xlf",
"baseHref": ""
}
}
},
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"builder": "@angular-devkit/build-angular:application",
"options": {
"outputPath": "dist/angular-course",
"outputPath": {
"base": "dist/angular-course"
},
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"polyfills": [
"src/polyfills.ts"
],
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
{
"input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
"input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"inject": true
},
"src/styles.css"
],
"scripts": []
"scripts": [
{
"input": "node_modules/document-register-element/build/document-register-element.js",
"inject": true
}
],
"extractLicenses": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true,
"browser": "src/main.ts"
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
@@ -41,30 +69,43 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
"extractLicenses": true
},
"fr": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"outputPath": {
"base": "dist/angular-course-fr/"
},
"i18nFile": "src/locale/messages.fr.xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "ignore"
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular-course:build"
"buildTarget": "angular-course:build"
},
"configurations": {
"production": {
"browserTarget": "angular-course:build:production"
"buildTarget": "angular-course:build:production"
},
"fr": {
"buildTarget": "angular-course:build:fr"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-course:build"
"buildTarget": "angular-course:build"
}
},
"test": {
@@ -76,7 +117,8 @@
"karmaConfig": "src/karma.conf.js",
"styles": [
{
"input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
"input": "node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"inject": true
},
"src/styles.css"
],
@@ -86,18 +128,6 @@
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
@@ -116,18 +146,37 @@
"devServerTarget": "angular-course:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "angular-course"
}
"cli": {
"analytics": "e878a578-eb4f-4c7c-bbaf-6f0c4ac42135"
},
"schematics": {
"@schematics/angular:component": {
"type": "component"
},
"@schematics/angular:directive": {
"type": "directive"
},
"@schematics/angular:service": {
"type": "service"
},
"@schematics/angular:guard": {
"typeSeparator": "."
},
"@schematics/angular:interceptor": {
"typeSeparator": "."
},
"@schematics/angular:module": {
"typeSeparator": "."
},
"@schematics/angular:pipe": {
"typeSeparator": "."
},
"@schematics/angular:resolver": {
"typeSeparator": "."
}
}
}
30,180 changes: 21,917 additions & 8,263 deletions package-lock.json

Large diffs are not rendered by default.

63 changes: 32 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -8,46 +8,47 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"server": "./node_modules/.bin/ts-node -O '{\"module\": \"commonjs\"}' ./server.ts"
"server": "ts-node -P ./server.tsconfig.json ./server.ts"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.1.0",
"@angular/cdk": "^6.2.0",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/material": "^6.4.6",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@angular/animations": "^20.0.1",
"@angular/cdk": "^20.0.2",
"@angular/common": "^20.0.1",
"@angular/compiler": "^20.0.1",
"@angular/core": "^20.0.1",
"@angular/elements": "^20.0.1",
"@angular/forms": "^20.0.1",
"@angular/localize": "^20.0.1",
"@angular/material": "^20.0.2",
"@angular/platform-browser": "^20.0.1",
"@angular/platform-browser-dynamic": "^20.0.1",
"@angular/router": "^20.0.1",
"body-parser": "^1.18.3",
"core-js": "^2.5.4",
"cors": "^2.8.5",
"document-register-element": "1.8.1",
"express": "^4.16.3",
"rxjs": "^6.0.0",
"zone.js": "~0.8.26"
"rxjs": "^6.5.4",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.7.0",
"@angular/cli": "~6.1.4",
"@angular/compiler-cli": "^6.1.0",
"@angular/language-service": "^6.1.0",
"@types/jasmine": "~2.8.6",
"@angular-devkit/build-angular": "^20.0.1",
"@angular/cli": "^20.0.1",
"@angular/compiler-cli": "^20.0.1",
"@angular/language-service": "^20.0.1",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"@types/node": "^12.11.1",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.2",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.7.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
"tslint": "~6.1.0",
"typescript": "~5.8.3"
}
}
3 changes: 2 additions & 1 deletion server.ts
Original file line number Diff line number Diff line change
@@ -4,12 +4,13 @@ import * as express from 'express';
import {Application} from "express";
import {getAllCourses} from './server/get-courses.route';
import {saveCourse} from './server/save-course.route';

const cors = require('cors');

const bodyParser = require('body-parser');

const app: Application = express();

app.use(cors({origin: true}));
app.use(bodyParser.json());

app.route('/api/courses').get(getAllCourses);
5 changes: 5 additions & 0 deletions server.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"compilerOptions": {
"module": "commonjs"
}
}
10 changes: 5 additions & 5 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { TestBed, async } from '@angular/core/testing';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
it('should create the app', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'angular-course'`, async(() => {
it(`should have as title 'angular-course'`, waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('angular-course');
}));
it('should render title in a h1 tag', async(() => {
it('should render title in a h1 tag', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
7 changes: 4 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -6,9 +6,10 @@ import {HighlightedDirective} from './directives/highlighted.directive';
import {Observable} from 'rxjs';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
standalone: false
})
export class AppComponent implements OnInit {

27 changes: 10 additions & 17 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -7,22 +7,15 @@ import { CourseCardComponent } from './course-card/course-card.component';
import { CourseImageComponent } from './course-image/course-image.component';
import { HighlightedDirective } from './directives/highlighted.directive';
import { NgxUnlessDirective } from './directives/ngx-unless.directive';
import {HttpClientModule} from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';

@NgModule({
declarations: [
AppComponent,
CourseCardComponent,
CourseImageComponent,
HighlightedDirective,
NgxUnlessDirective
],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule
],
providers: [],
bootstrap: [AppComponent]
})
@NgModule({ declarations: [
AppComponent,
CourseCardComponent,
CourseImageComponent,
HighlightedDirective,
NgxUnlessDirective
],
bootstrap: [AppComponent], imports: [BrowserModule,
BrowserAnimationsModule], providers: [provideHttpClient(withInterceptorsFromDi())] })
export class AppModule { }
4 changes: 2 additions & 2 deletions src/app/course-card/course-card.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';

import { CourseCardComponent } from './course-card.component';

describe('CourseCardComponent', () => {
let component: CourseCardComponent;
let fixture: ComponentFixture<CourseCardComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CourseCardComponent ]
})
3 changes: 2 additions & 1 deletion src/app/course-card/course-card.component.ts
Original file line number Diff line number Diff line change
@@ -17,7 +17,8 @@ import {CourseImageComponent} from '../course-image/course-image.component';
@Component({
selector: 'course-card',
templateUrl: './course-card.component.html',
styleUrls: ['./course-card.component.css']
styleUrls: ['./course-card.component.css'],
standalone: false
})
export class CourseCardComponent implements OnInit {

4 changes: 2 additions & 2 deletions src/app/course-image/course-image.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';

import { CourseImageComponent } from './course-image.component';

describe('CourseImageComponent', () => {
let component: CourseImageComponent;
let fixture: ComponentFixture<CourseImageComponent>;

beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CourseImageComponent ]
})
7 changes: 4 additions & 3 deletions src/app/course-image/course-image.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import {Component, Input, OnInit} from '@angular/core';

@Component({
selector: 'course-image',
templateUrl: './course-image.component.html',
styleUrls: ['./course-image.component.css']
selector: 'course-image',
templateUrl: './course-image.component.html',
styleUrls: ['./course-image.component.css'],
standalone: false
})
export class CourseImageComponent implements OnInit {

3 changes: 2 additions & 1 deletion src/app/directives/highlighted.directive.ts
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@ import {Directive, EventEmitter, HostBinding, HostListener, Input, Output} from

@Directive({
selector: '[highlighted]',
exportAs: 'hl'
exportAs: 'hl',
standalone: false
})
export class HighlightedDirective {

3 changes: 2 additions & 1 deletion src/app/directives/ngx-unless.directive.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {Directive, Input, TemplateRef, ViewContainerRef} from '@angular/core';

@Directive({
selector: '[ngxUnless]'
selector: '[ngxUnless]',
standalone: false
})
export class NgxUnlessDirective {

9 changes: 0 additions & 9 deletions src/browserslist

This file was deleted.

2 changes: 1 addition & 1 deletion src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -12,4 +12,4 @@ export const environment = {
* below file. Don't forget to comment it out in production mode
* because it will have a performance impact when errors are thrown
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
18 changes: 5 additions & 13 deletions src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/***************************************************************************************************
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
@@ -34,24 +38,12 @@
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';


/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';


/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
**/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.

/**
* By default, zone.js will patch all possible macroTask and DomEvents
@@ -71,7 +63,7 @@ import 'core-js/es7/reflect';
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'zone.js'; // Included with Angular CLI.



12 changes: 4 additions & 8 deletions src/test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js/dist/zone-testing';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';

declare const require: any;

// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
platformBrowserDynamicTesting(), {
teardown: { destroyAfterEach: false }
}
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
9 changes: 6 additions & 3 deletions src/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -4,8 +4,11 @@
"outDir": "../out-tsc/app",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
11 changes: 6 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -3,19 +3,20 @@
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"esModuleInterop": true,
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"module": "esnext",
"moduleResolution": "bundler",
"experimentalDecorators": true,
"target": "es5",
"target": "ES2022",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
],
"useDefineForClassFields": false
}
}
9 changes: 4 additions & 5 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -72,7 +72,6 @@
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
@@ -117,12 +116,12 @@
"check-type"
],
"no-output-on-prefix": true,
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-inputs-metadata-property": true,
"no-outputs-metadata-property": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true