35 |
├── .gitignore
├── .vscode
    └── settings.json
├── README.md
├── angular.json
├── package-lock.json
├── package.json
├── src
    ├── app
    │   ├── app-routing.module.ts
    │   ├── app.component.ts
    │   ├── app.module.ts
    │   ├── feature
    │   │   ├── feature.component.html
    │   │   └── feature.component.ts
    │   ├── home
    │   │   ├── home.component.html
    │   │   └── home.component.ts
    │   ├── main.ts
    │   └── shared
    │   │   └── data.service.ts
    ├── assets
    │   ├── .gitkeep
    │   └── styles
    │   │   └── styles.css
    ├── environments
    │   ├── environment.prod.ts
    │   └── environment.ts
    ├── favicon.ico
    ├── index.html
    ├── main.ts
    ├── polyfills.ts
    ├── styles.css
    ├── tsconfig.app.json
    └── typings.d.ts
└── tsconfig.json
/.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 | 
 8 | # dependencies
 9 | /node_modules
10 | 
11 | # IDEs and editors
12 | /.idea
13 | .project
14 | .classpath
15 | .c9/
16 | *.launch
17 | .settings/
18 | *.sublime-workspace
19 | 
20 | # IDE - VSCode
21 | .vscode/*
22 | !.vscode/settings.json
23 | !.vscode/tasks.json
24 | !.vscode/launch.json
25 | !.vscode/extensions.json
26 | 
27 | # misc
28 | /.sass-cache
29 | /connect.lock
30 | /coverage
31 | /libpeerconnection.log
32 | npm-debug.log
33 | testem.log
34 | /typings
35 | 
36 | # e2e
37 | /e2e/*.js
38 | /e2e/*.map
39 | 
40 | # System Files
41 | .DS_Store
42 | Thumbs.db
43 | 
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 |     "files.exclude": {
4 |       "**/app/**/*.js.map": true,
5 |       "**/app/**/*.js": true
6 |     }
7 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
 1 | # Angular and TypeScript Bare Bones Project
 2 | 
 3 | The Bare Bones project is an Angular starter project that has the npm modules, 
 4 | configuration, scripts, folders and routing in place.
 5 | 
 6 | Here's what is in the project:
 7 | 
 8 | * Angular scripts and TypeScript configuration are ready to go
 9 | * Angular bootstrapper wired up to the app component
10 | * App component with basic routing applied
11 | * Homepage component 
12 | * A single "feature" component (represents a custom feature your app would have)
13 | * A simple data service to provide data and show dependency injection
14 | * Routing between the homepage and the "feature"
15 | * Bootstrap for CSS
16 | 
17 | It's a minimal app intended to get you up and running quickly so the rest is up to you!
18 | 
19 | If you're using VS Code, install my [Angular code snippets](https://blog.codewithdan.com/2017/04/01/angular-2-typescript-and-html-snippets-for-vs-code/) 
20 | to simplify the process of writing Angular code. The code snippets make it easy
21 | to build Angular components, services, pipes, directives and more.
22 | 
23 | 
24 | ## Running the Application
25 | 
26 | 1. Install [Node.js](http://nodejs.org)
27 | 
28 | 1. Install the Angular CLI:
29 | 
30 |     `npm install -g @angular/cli`
31 | 
32 | 1. Run `npm install` to install app dependencies
33 | 
34 | 1. Run `ng serve -o` to start the server and launch the app
35 | 
--------------------------------------------------------------------------------
/angular.json:
--------------------------------------------------------------------------------
  1 | {
  2 |   "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  3 |   "version": 1,
  4 |   "newProjectRoot": "projects",
  5 |   "projects": {
  6 |     "angular-bare-bones": {
  7 |       "root": "",
  8 |       "sourceRoot": "src",
  9 |       "projectType": "application",
 10 |       "architect": {
 11 |         "build": {
 12 |           "builder": "@angular-devkit/build-angular:browser",
 13 |           "options": {
 14 |             "outputPath": "dist",
 15 |             "index": "src/index.html",
 16 |             "main": "src/main.ts",
 17 |             "tsConfig": "src/tsconfig.app.json",
 18 |             "polyfills": "src/polyfills.ts",
 19 |             "assets": [
 20 |               "src/assets",
 21 |               "src/favicon.ico"
 22 |             ],
 23 |             "styles": [
 24 |               "src/styles.css"
 25 |             ],
 26 |             "scripts": []
 27 |           },
 28 |           "configurations": {
 29 |             "production": {
 30 |               "optimization": true,
 31 |               "outputHashing": "all",
 32 |               "sourceMap": false,
 33 |               "extractCss": true,
 34 |               "namedChunks": false,
 35 |               "aot": true,
 36 |               "extractLicenses": true,
 37 |               "vendorChunk": false,
 38 |               "buildOptimizer": true,
 39 |               "fileReplacements": [
 40 |                 {
 41 |                   "replace": "src/environments/environment.ts",
 42 |                   "with": "src/environments/environment.prod.ts"
 43 |                 }
 44 |               ]
 45 |             }
 46 |           }
 47 |         },
 48 |         "serve": {
 49 |           "builder": "@angular-devkit/build-angular:dev-server",
 50 |           "options": {
 51 |             "browserTarget": "angular-bare-bones:build"
 52 |           },
 53 |           "configurations": {
 54 |             "production": {
 55 |               "browserTarget": "angular-bare-bones:build:production"
 56 |             }
 57 |           }
 58 |         },
 59 |         "extract-i18n": {
 60 |           "builder": "@angular-devkit/build-angular:extract-i18n",
 61 |           "options": {
 62 |             "browserTarget": "angular-bare-bones:build"
 63 |           }
 64 |         },
 65 |         "test": {
 66 |           "builder": "@angular-devkit/build-angular:karma",
 67 |           "options": {
 68 |             "main": "src/test.ts",
 69 |             "karmaConfig": "./karma.conf.js",
 70 |             "polyfills": "src/polyfills.ts",
 71 |             "tsConfig": "src/tsconfig.spec.json",
 72 |             "scripts": [],
 73 |             "styles": [
 74 |               "src/styles.css"
 75 |             ],
 76 |             "assets": [
 77 |               "src/assets",
 78 |               "src/favicon.ico"
 79 |             ]
 80 |           }
 81 |         },
 82 |         "lint": {
 83 |           "builder": "@angular-devkit/build-angular:tslint",
 84 |           "options": {
 85 |             "tsConfig": [
 86 |               "src/tsconfig.app.json",
 87 |               "src/tsconfig.spec.json"
 88 |             ],
 89 |             "exclude": [
 90 |               "**/node_modules/**"
 91 |             ]
 92 |           }
 93 |         }
 94 |       }
 95 |     },
 96 |     "angular-bare-bones-e2e": {
 97 |       "root": "",
 98 |       "sourceRoot": "",
 99 |       "projectType": "application",
100 |       "architect": {
101 |         "e2e": {
102 |           "builder": "@angular-devkit/build-angular:protractor",
103 |           "options": {
104 |             "protractorConfig": "./protractor.conf.js",
105 |             "devServerTarget": "angular-bare-bones:serve"
106 |           }
107 |         },
108 |         "lint": {
109 |           "builder": "@angular-devkit/build-angular:tslint",
110 |           "options": {
111 |             "tsConfig": [
112 |               "e2e/tsconfig.e2e.json"
113 |             ],
114 |             "exclude": [
115 |               "**/node_modules/**"
116 |             ]
117 |           }
118 |         }
119 |       }
120 |     }
121 |   },
122 |   "defaultProject": "angular-bare-bones",
123 |   "schematics": {
124 |     "@schematics/angular:class": {
125 |       "spec": false
126 |     },
127 |     "@schematics/angular:component": {
128 |       "inlineStyle": true,
129 |       "inlineTemplate": true,
130 |       "spec": false,
131 |       "prefix": "app",
132 |       "styleext": "css"
133 |     },
134 |     "@schematics/angular:directive": {
135 |       "spec": false,
136 |       "prefix": "app"
137 |     },
138 |     "@schematics/angular:guard": {
139 |       "spec": false
140 |     },
141 |     "@schematics/angular:module": {
142 |       "spec": false
143 |     },
144 |     "@schematics/angular:pipe": {
145 |       "spec": false
146 |     },
147 |     "@schematics/angular:service": {
148 |       "spec": false
149 |     }
150 |   }
151 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
 1 | {
 2 |   "name": "angular-bare-bones",
 3 |   "version": "0.0.0",
 4 |   "license": "MIT",
 5 |   "scripts": {
 6 |     "ng": "ng",
 7 |     "start": "ng serve",
 8 |     "build": "ng build",
 9 |     "test": "ng test",
10 |     "lint": "ng lint",
11 |     "e2e": "ng e2e"
12 |   },
13 |   "private": true,
14 |   "dependencies": {
15 |     "@angular/animations": "^7.0.0",
16 |     "@angular/common": "^7.0.0",
17 |     "@angular/compiler": "^7.0.0",
18 |     "@angular/core": "^7.0.0",
19 |     "@angular/forms": "^7.0.0",
20 |     "@angular/http": "^7.0.0",
21 |     "@angular/platform-browser": "^7.0.0",
22 |     "@angular/platform-browser-dynamic": "^7.0.0",
23 |     "@angular/router": "^7.0.0",
24 |     "core-js": "^2.5.7",
25 |     "rxjs": "^6.3.3",
26 |     "zone.js": "^0.8.26"
27 |   },
28 |   "devDependencies": {
29 |     "@angular/cli": "^7.0.2",
30 |     "@angular/compiler-cli": "^7.0.0",
31 |     "@angular/language-service": "^7.0.0",
32 |     "typescript": "3.1.3",
33 |     "@angular-devkit/build-angular": "~0.10.0"
34 |   }
35 | }
36 | 
--------------------------------------------------------------------------------
/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
 1 | import { NgModule } from '@angular/core';
 2 | import { Routes, RouterModule } from '@angular/router';
 3 | 
 4 | import { HomeComponent } from './home/home.component';
 5 | import { FeatureComponent } from './feature/feature.component';
 6 | 
 7 | const routes: Routes = [
 8 |   { path: '',  pathMatch:'full', redirectTo: '/home' },
 9 |   { path: 'home',  component: HomeComponent },
10 |   { path: 'feature', component: FeatureComponent }
11 | ];
12 | 
13 | @NgModule({
14 |   imports: [RouterModule.forRoot(routes)],
15 |   exports: [RouterModule]
16 | })
17 | export class AppRoutingModule {
18 |   static components = [ HomeComponent, FeatureComponent ];
19 | }
20 | 
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
 1 | import { Component } from '@angular/core';
 2 | 
 3 | @Component({ 
 4 |   selector: 'app-root',
 5 |   template: `