Skip to content

Commit baee456

Browse files
committed
Initial commit
0 parents  commit baee456

13 files changed

+322
-0
lines changed

Diff for: README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# angular-simple-event
2+
3+
[Edit on StackBlitz ⚡️](https://stackblitz.com/edit/angular-simple-event)

Diff for: angular.json

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"demo": {
7+
"root": "",
8+
"sourceRoot": "src",
9+
"projectType": "application",
10+
"prefix": "app",
11+
"schematics": {},
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:browser",
15+
"options": {
16+
"outputPath": "dist/demo",
17+
"index": "src/index.html",
18+
"main": "src/main.ts",
19+
"polyfills": "src/polyfills.ts",
20+
"tsConfig": "src/tsconfig.app.json",
21+
"assets": [
22+
"src/favicon.ico",
23+
"src/assets"
24+
],
25+
"styles": [
26+
"src/styles.css"
27+
],
28+
"scripts": []
29+
},
30+
"configurations": {
31+
"production": {
32+
"fileReplacements": [
33+
{
34+
"replace": "src/environments/environment.ts",
35+
"with": "src/environments/environment.prod.ts"
36+
}
37+
],
38+
"optimization": true,
39+
"outputHashing": "all",
40+
"sourceMap": false,
41+
"extractCss": true,
42+
"namedChunks": false,
43+
"aot": true,
44+
"extractLicenses": true,
45+
"vendorChunk": false,
46+
"buildOptimizer": true
47+
}
48+
}
49+
},
50+
"serve": {
51+
"builder": "@angular-devkit/build-angular:dev-server",
52+
"options": {
53+
"browserTarget": "demo:build"
54+
},
55+
"configurations": {
56+
"production": {
57+
"browserTarget": "demo:build:production"
58+
}
59+
}
60+
},
61+
"extract-i18n": {
62+
"builder": "@angular-devkit/build-angular:extract-i18n",
63+
"options": {
64+
"browserTarget": "demo:build"
65+
}
66+
},
67+
"test": {
68+
"builder": "@angular-devkit/build-angular:karma",
69+
"options": {
70+
"main": "src/test.ts",
71+
"polyfills": "src/polyfills.ts",
72+
"tsConfig": "src/tsconfig.spec.json",
73+
"karmaConfig": "src/karma.conf.js",
74+
"styles": [
75+
"styles.css"
76+
],
77+
"scripts": [],
78+
"assets": [
79+
"src/favicon.ico",
80+
"src/assets"
81+
]
82+
}
83+
},
84+
"lint": {
85+
"builder": "@angular-devkit/build-angular:tslint",
86+
"options": {
87+
"tsConfig": [
88+
"src/tsconfig.app.json",
89+
"src/tsconfig.spec.json"
90+
],
91+
"exclude": [
92+
"**/node_modules/**"
93+
]
94+
}
95+
}
96+
}
97+
}
98+
},
99+
"defaultProject": "demo"
100+
}

Diff for: package.json

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "angular",
3+
"version": "0.0.0",
4+
"private": true,
5+
"dependencies": {
6+
"@angular/common": "^8.0.0",
7+
"@angular/compiler": "^8.0.0",
8+
"@angular/core": "^8.0.0",
9+
"@angular/forms": "^8.0.0",
10+
"@angular/platform-browser": "^8.0.0",
11+
"@angular/platform-browser-dynamic": "^8.0.0",
12+
"@angular/router": "^8.0.0",
13+
"core-js": "2",
14+
"rxjs": "^6.5.2",
15+
"zone.js": "^0.9.1"
16+
},
17+
"scripts": {
18+
"ng": "ng",
19+
"start": "ng serve",
20+
"build": "ng build",
21+
"test": "ng test",
22+
"lint": "ng lint",
23+
"e2e": "ng e2e"
24+
},
25+
"devDependencies": {
26+
"@angular-devkit/build-angular": "~0.10.0",
27+
"@angular/cli": "~7.0.2",
28+
"@angular/compiler-cli": "~7.0.0",
29+
"@angular/language-service": "~7.0.0",
30+
"@types/node": "~8.9.4",
31+
"@types/jasmine": "~2.8.8",
32+
"@types/jasminewd2": "~2.0.3",
33+
"codelyzer": "~4.5.0",
34+
"jasmine-core": "~2.99.1",
35+
"jasmine-spec-reporter": "~4.2.1",
36+
"karma": "~3.0.0",
37+
"karma-chrome-launcher": "~2.2.0",
38+
"karma-coverage-istanbul-reporter": "~2.0.1",
39+
"karma-jasmine": "~1.1.2",
40+
"karma-jasmine-html-reporter": "^0.2.2",
41+
"protractor": "~5.4.0",
42+
"ts-node": "~7.0.0",
43+
"tslint": "~5.11.0",
44+
"typescript": "~3.1.1"
45+
}
46+
}

Diff for: src/app/app.component.css

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.container {
2+
display: flex;
3+
flex-direction: row;
4+
align-items: flex-start;
5+
justify-content: flex-start;
6+
width: 100vw;
7+
height: 100vh;
8+
padding: 5px;
9+
10+
}
11+
12+
button {
13+
width: 100px;
14+
height: 45px;
15+
font-size: 20px;
16+
font-family:Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
17+
background-color: darkorange;
18+
color: green;
19+
border-radius: 10px;
20+
21+
}

Diff for: src/app/app.component.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="container">
2+
<button (click)="saySomething()"> Click me </button>
3+
</div>

Diff for: src/app/app.component.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'my-app',
5+
templateUrl: './app.component.html',
6+
styleUrls: [ './app.component.css' ]
7+
})
8+
9+
export class AppComponent {
10+
11+
constructor () {}
12+
13+
saySomething() {
14+
alert("good day")
15+
}
16+
17+
}

Diff for: src/app/app.module.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserModule } from '@angular/platform-browser';
3+
import { FormsModule } from '@angular/forms';
4+
5+
import { AppComponent } from './app.component';
6+
7+
@NgModule({
8+
imports: [ BrowserModule, FormsModule ],
9+
declarations: [ AppComponent ],
10+
bootstrap: [ AppComponent ]
11+
})
12+
export class AppModule { }

Diff for: src/app/car.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// here is where we export the Car interface!
2+
export interface Car {
3+
make: string;
4+
model: string;
5+
miles: number;
6+
}

Diff for: src/app/transportation.service.ts

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { Injectable } from '@angular/core';
2+
import { Car } from './car';
3+
4+
@Injectable({
5+
providedIn: 'root'
6+
})
7+
export class TransportationService {
8+
9+
// new code
10+
subaru: Car = {make: 'Subaru', model: 'Outback', miles: 58232};
11+
honda: Car = {make: 'Honda', model: 'Accord', miles: 39393};
12+
bmw: Car = {make: 'BMW', model: 'X3', miles: 4400};
13+
14+
cars:Car[] = [this.subaru, this.honda, this.bmw];
15+
16+
17+
18+
constructor() { }
19+
20+
// new code
21+
getCars() {
22+
return this.cars;
23+
}
24+
25+
}

Diff for: src/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<my-app>loading</my-app>

Diff for: src/main.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import './polyfills';
2+
3+
import { enableProdMode } from '@angular/core';
4+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
5+
6+
import { AppModule } from './app/app.module';
7+
8+
platformBrowserDynamic().bootstrapModule(AppModule).then(ref => {
9+
// Ensure Angular destroys itself on hot reloads.
10+
if (window['ngRef']) {
11+
window['ngRef'].destroy();
12+
}
13+
window['ngRef'] = ref;
14+
15+
// Otherwise, log the boot error
16+
}).catch(err => console.error(err));

Diff for: src/polyfills.ts

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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/docs/ts/latest/guide/browser-support.html
15+
*/
16+
17+
/***************************************************************************************************
18+
* BROWSER POLYFILLS
19+
*/
20+
21+
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
22+
// import 'core-js/es6/symbol';
23+
// import 'core-js/es6/object';
24+
// import 'core-js/es6/function';
25+
// import 'core-js/es6/parse-int';
26+
// import 'core-js/es6/parse-float';
27+
// import 'core-js/es6/number';
28+
// import 'core-js/es6/math';
29+
// import 'core-js/es6/string';
30+
// import 'core-js/es6/date';
31+
// import 'core-js/es6/array';
32+
// import 'core-js/es6/regexp';
33+
// import 'core-js/es6/map';
34+
// import 'core-js/es6/set';
35+
36+
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
37+
// import 'classlist.js'; // Run `npm install --save classlist.js`.
38+
39+
/** IE10 and IE11 requires the following to support `@angular/animation`. */
40+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
41+
42+
43+
/** Evergreen browsers require these. **/
44+
// import 'core-js/es6/reflect';
45+
// import 'core-js/es7/reflect';
46+
47+
48+
/**
49+
* Web Animations `@angular/platform-browser/animations`
50+
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
51+
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
52+
*/
53+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
54+
55+
56+
57+
/***************************************************************************************************
58+
* Zone JS is required by Angular itself.
59+
*/
60+
import 'zone.js/dist/zone'; // Included with Angular CLI.
61+
62+
63+
/***************************************************************************************************
64+
* APPLICATION IMPORTS
65+
*/
66+
67+
/**
68+
* Date, currency, decimal and percent pipes.
69+
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
70+
*/
71+
// import 'intl'; // Run `npm install --save intl`.

Diff for: src/styles.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Add application styles & imports to this file! */

0 commit comments

Comments
 (0)