├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── app ├── about │ ├── about.component.html │ └── about.component.ts ├── app.component.css ├── app.component.html ├── app.component.ts ├── app.spec.ts ├── boot.ts ├── common │ ├── experiment.model.ts │ ├── experiments.service.ts │ └── state.service.ts ├── experiments │ ├── experiment-details │ │ ├── experiment.detail.component.html │ │ └── experiment.detail.component.ts │ ├── experiments.component.html │ └── experiments.component.ts └── home │ ├── home.component.html │ ├── home.component.spec.ts │ └── home.component.ts ├── favicon.ico ├── images ├── logo.png └── top-shadow.png ├── index.html ├── karma.conf.js ├── package.json ├── spec-bundle.js ├── tsconfig.json ├── typings.json ├── webpack.config.js └── webpack.test.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # @AngularClass 2 | # http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_style = space 9 | indent_size = 2 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | insert_final_newline = false 16 | trim_trailing_whitespace = false 17 | 18 | [*.json] 19 | insert_final_newline = false 20 | trim_trailing_whitespace = false 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | typings 2 | app/**/*.js 3 | app/**/*.map 4 | node_modules 5 | jspm_packages 6 | bower_components 7 | 8 | .idea/ 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Building an Angular 2 Website Using Routes 2 | This is a simple Angular 2 website using the brand new router. It demonstrates how to build components, configure routes, inject services, and use the `@Input` decorator to bind properties to components. 3 | 4 | ## Dependencies 5 | - You must have `node` and `npm` installed (via `brew install node` or [NodeJS.org](https://nodejs.org/en/)); 6 | - You must also have `typings` installed globally via `npm i -g typings` 7 | - Be sure that you have `typings` version `1.x` 8 | 9 | ## Getting Started 10 | 11 | 12 | ```bash 13 | git clone https://github.com/simpulton/angular2-website-routes.git 14 | cd angular2-website-routes 15 | npm i 16 | typings install 17 | npm start 18 | ``` 19 | 20 | Then navigate your browser to [http://localhost:3001](http://localhost:3001) and use the app. 21 | 22 | ## Testing 23 | The test setup includes `webpack.test.config.js`, `spec-bundle.js`, and `karma.conf.js`. To run unit tests, execute `npm test` in your terminal. 24 | -------------------------------------------------------------------------------- /app/about/about.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 |

{{ body }}

3 | 4 |
5 |
6 |

About: {{ message }}

7 |
8 | 9 | 10 |
11 |
12 | -------------------------------------------------------------------------------- /app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {StateService} from '../common/state.service'; 3 | 4 | @Component({ 5 | selector: 'about', 6 | template: require('./about.component.html') 7 | }) 8 | export class AboutComponent implements OnInit{ 9 | title: string = 'About Page'; 10 | body: string = 'This is the about page body'; 11 | message: string; 12 | 13 | constructor(public _stateService: StateService) { } 14 | 15 | ngOnInit() { 16 | this.message = this._stateService.getMessage(); 17 | } 18 | 19 | updateMessage(m: string): void { 20 | this._stateService.setMessage(m); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/app.component.css: -------------------------------------------------------------------------------- 1 | #header { 2 | height: 64px; 3 | background: #fff; 4 | position: fixed; 5 | header: 0; 6 | left: 0; 7 | width: 100%; 8 | } 9 | 10 | #header h1#logo { 11 | float: left; 12 | margin: 0; 13 | } 14 | 15 | #header h1#logo a { 16 | background: url(../images/logo.png) no-repeat top left; 17 | width: 194px; 18 | height: 48px; 19 | margin: 8px; 20 | display: block; 21 | text-indent: -9999px; 22 | } 23 | 24 | #header .router-link-active { 25 | color: #C83434; 26 | } 27 | 28 | #header .color { 29 | display: block; 30 | height: 4px; 31 | position: absolute; 32 | top: 100%; 33 | width: 100%; 34 | } 35 | 36 | #header #menu {float:left;padding:17px 40px 0 0;} 37 | 38 | #container {padding:100px 20px 20px 20px;} 39 | 40 | .color { 41 | background-color: rgba(195, 30, 30, 0.9) !important; 42 | } 43 | 44 | .shadow { 45 | background: url(../images/top-shadow.png) repeat-x; 46 | height: 35px; 47 | position: fixed; 48 | top: 68px; 49 | width: 100%; 50 | } 51 | -------------------------------------------------------------------------------- /app/app.component.html: -------------------------------------------------------------------------------- 1 | 15 | 16 |
17 | 18 |
19 | 20 |
21 | -------------------------------------------------------------------------------- /app/app.component.ts: -------------------------------------------------------------------------------- 1 | import {Component} from '@angular/core'; 2 | import {Routes, ROUTER_DIRECTIVES} from '@angular/router'; 3 | import {AboutComponent} from './about/about.component'; 4 | import {ExperimentsComponent} from './experiments/experiments.component'; 5 | import {HomeComponent} from './home/home.component'; 6 | import {StateService} from './common/state.service'; 7 | import {ExperimentsService} from './common/experiments.service'; 8 | 9 | @Component({ 10 | selector: 'app', 11 | template: require('./app.component.html'), 12 | styles: [require('./app.component.css')], 13 | directives: [ ROUTER_DIRECTIVES ], 14 | providers: [StateService, ExperimentsService], 15 | }) 16 | @Routes([ 17 | {path: '/', component: HomeComponent }, 18 | {path: '/home', component: HomeComponent }, 19 | {path: '/about', component: AboutComponent }, 20 | {path: '/experiments', component: ExperimentsComponent }, 21 | {path: '/*', component: HomeComponent } 22 | ]) 23 | export class AppComponent {} 24 | -------------------------------------------------------------------------------- /app/app.spec.ts: -------------------------------------------------------------------------------- 1 | import { describe, it, expect } from '@angular/core/testing'; 2 | 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | it('should be a function', () => { 7 | expect(typeof AppComponent).toBe('function'); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /app/boot.ts: -------------------------------------------------------------------------------- 1 | import 'core-js'; 2 | import 'zone.js/dist/zone'; 3 | 4 | import {bootstrap} from '@angular/platform-browser-dynamic'; 5 | import {ROUTER_PROVIDERS} from '@angular/router'; 6 | import {AppComponent} from './app.component'; 7 | 8 | bootstrap(AppComponent, [ 9 | ROUTER_PROVIDERS 10 | ]); 11 | -------------------------------------------------------------------------------- /app/common/experiment.model.ts: -------------------------------------------------------------------------------- 1 | export interface Experiment { 2 | name: string; 3 | description: string; 4 | completed: number; 5 | } 6 | -------------------------------------------------------------------------------- /app/common/experiments.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | import {Experiment} from './experiment.model'; 3 | 4 | @Injectable() 5 | export class ExperimentsService { 6 | private experiments: Experiment[] = [ 7 | {name: 'Experiment 1', description: 'This is an experiment', completed:0}, 8 | {name: 'Experiment 2', description: 'This is an experiment', completed:0}, 9 | {name: 'Experiment 3', description: 'This is an experiment', completed:0}, 10 | {name: 'Experiment 4', description: 'This is an experiment', completed:0} 11 | ]; 12 | 13 | getExperiments(): Experiment[] { 14 | return this.experiments; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /app/common/state.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from '@angular/core'; 2 | 3 | @Injectable() 4 | export class StateService { 5 | private _message = 'Hello Message'; 6 | 7 | getMessage(): string { 8 | return this._message; 9 | }; 10 | 11 | setMessage(newMessage: string): void { 12 | this._message = newMessage; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /app/experiments/experiment-details/experiment.detail.component.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | {{ experiment.name }} 4 |

5 |

6 | {{ experiment.description }} 7 |

8 |

9 | {{experiment.completed}} 10 |

11 |
12 | -------------------------------------------------------------------------------- /app/experiments/experiment-details/experiment.detail.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, Input} from '@angular/core'; 2 | import {Experiment} from '../../common/experiment.model'; 3 | 4 | @Component({ 5 | selector: 'experiment', 6 | template: require('./experiment.detail.component.html'), 7 | styles: [` 8 | .experiment { 9 | cursor: pointer; 10 | outline: 1px lightgray solid; 11 | padding: 5px; 12 | margin: 5px; 13 | } 14 | `] 15 | }) 16 | 17 | export class ExperimentDetailComponent { 18 | @Input() experiment: Experiment; 19 | 20 | doExperiment(): void { 21 | this.experiment.completed += 1; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /app/experiments/experiments.component.html: -------------------------------------------------------------------------------- 1 |

2 | {{ title }} 3 |

4 |

5 | {{ body }} 6 |

7 |
8 | 9 |
10 |
11 |

Experiments: {{message}}

12 |
13 | 14 | 15 |
16 |
17 | -------------------------------------------------------------------------------- /app/experiments/experiments.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {NgFor} from '@angular/common'; 3 | import {Experiment} from '../common/experiment.model'; 4 | import {ExperimentsService} from '../common/experiments.service'; 5 | import {StateService} from '../common/state.service'; 6 | import {ExperimentDetailComponent} from './experiment-details/experiment.detail.component'; 7 | 8 | @Component({ 9 | selector: 'experiments', 10 | template: require('./experiments.component.html'), 11 | directives: [ExperimentDetailComponent] 12 | }) 13 | export class ExperimentsComponent implements OnInit { 14 | title: string = 'Experiments Page'; 15 | body: string = 'This is the about experiments body'; 16 | message: string; 17 | experiments: Experiment[]; 18 | 19 | constructor( 20 | private _stateService: StateService, 21 | private _experimentsService: ExperimentsService) {} 22 | 23 | ngOnInit() { 24 | this.experiments = this._experimentsService.getExperiments(); 25 | this.message = this._stateService.getMessage(); 26 | } 27 | 28 | updateMessage(m: string): void { 29 | this._stateService.setMessage(m); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/home/home.component.html: -------------------------------------------------------------------------------- 1 |

2 | {{ title }} 3 |

4 |

5 | {{ body }} 6 |

7 | 8 |
9 |
10 |

Home: {{ message }}

11 |
12 | 13 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | 2 | import { 3 | describe, 4 | expect, 5 | it 6 | } from '@angular/core/testing'; 7 | 8 | import { HomeComponent } from './home.component'; 9 | 10 | describe('Home Component', () => { 11 | it('should be named `HomeComponent`', () => { 12 | expect(HomeComponent['name']).toBe('HomeComponent'); 13 | }); 14 | 15 | it('should have a method called `updateMessage`', () => { 16 | expect(HomeComponent.prototype.updateMessage).toBeDefined(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from '@angular/core'; 2 | import {StateService} from '../common/state.service'; 3 | 4 | @Component({ 5 | selector: 'home', 6 | template: require('./home.component.html') 7 | }) 8 | export class HomeComponent implements OnInit { 9 | title: string = 'Home Page'; 10 | body: string = 'This is the about home body'; 11 | message: string; 12 | 13 | constructor(private _stateService: StateService) { } 14 | 15 | ngOnInit() { 16 | this.message = this._stateService.getMessage(); 17 | } 18 | 19 | updateMessage(m: string): void { 20 | this._stateService.setMessage(m); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simpulton/angular2-website-routes/7166a0ed1b60375babb3e9fe3e7fe054783a53a2/favicon.ico -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simpulton/angular2-website-routes/7166a0ed1b60375babb3e9fe3e7fe054783a53a2/images/logo.png -------------------------------------------------------------------------------- /images/top-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/simpulton/angular2-website-routes/7166a0ed1b60375babb3e9fe3e7fe054783a53a2/images/top-shadow.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Loading... 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = function(config) { 2 | var webpackConfig = require('./webpack.test.config.js'); 3 | 4 | config.set({ 5 | basePath: '', 6 | frameworks: [ 'jasmine' ], 7 | files: [ { pattern: 'spec-bundle.js', watched: false } ], 8 | preprocessors: { 'spec-bundle.js': ['webpack', 'sourcemap'] }, 9 | webpack: webpackConfig, 10 | webpackServer: { noInfo: true }, 11 | reporters: [ 'spec' ], 12 | port: 9876, 13 | colors: true, 14 | logLevel: config.LOG_INFO, 15 | autoWatch: false, 16 | browsers: [ 'PhantomJS' ], 17 | singleRun: true 18 | }); 19 | }; 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fem-ng2-simple-app", 3 | "version": "0.0.1", 4 | "license": "SEE LICENSE IN LICENSE", 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/onehungrymind/fem-ng2-simple-app/" 8 | }, 9 | "scripts": { 10 | "start": "webpack-dev-server --inline --colors --watch --display-error-details --display-cached --port 3001 --hot", 11 | "test": "karma start" 12 | }, 13 | "dependencies": { 14 | "@angular/common": "2.0.0-rc.1", 15 | "@angular/compiler": "2.0.0-rc.1", 16 | "@angular/core": "2.0.0-rc.1", 17 | "@angular/platform-browser": "2.0.0-rc.1", 18 | "@angular/platform-browser-dynamic": "2.0.0-rc.1", 19 | "@angular/router": "2.0.0-rc.1", 20 | "es6-shim": "^0.35.0", 21 | "reflect-metadata": "0.1.3", 22 | "rxjs": "5.0.0-beta.6", 23 | "systemjs": "^0.19.27", 24 | "zone.js": "^0.6.12" 25 | }, 26 | "devDependencies": { 27 | "awesome-typescript-loader": "^0.17.0", 28 | "core-js": "^2.4.0", 29 | "jasmine-core": "^2.4.1", 30 | "karma": "^0.13.22", 31 | "karma-coverage": "^1.0.0", 32 | "karma-jasmine": "^1.0.2", 33 | "karma-phantomjs-launcher": "^1.0.0", 34 | "karma-sourcemap-loader": "^0.3.7", 35 | "karma-spec-reporter": "0.0.26", 36 | "karma-webpack": "^1.7.0", 37 | "phantomjs-prebuilt": "^2.1.7", 38 | "raw-loader": "^0.5.1", 39 | "source-map-loader": "^0.1.5", 40 | "typescript": "^1.8.10", 41 | "webpack": "^1.13.0", 42 | "webpack-dev-server": "^1.14.1" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /spec-bundle.js: -------------------------------------------------------------------------------- 1 | require('core-js'); 2 | require('zone.js'); 3 | 4 | var testContext = require.context('./app', true, /\.spec\.ts/); 5 | 6 | function requireAll(requireContext) { 7 | return requireContext.keys().map(requireContext); 8 | } 9 | 10 | var modules = requireAll(testContext); 11 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "sourceMap": true, 8 | "suppressImplicitAnyIndexErrors":true 9 | }, 10 | "compileOnSave": false, 11 | "buildOnSave": false, 12 | "exclude": [ 13 | "node_modules" 14 | ], 15 | "filesGlob": [ 16 | "app/**/*.ts", 17 | "typings/index.d.ts" 18 | ], 19 | "atom": { 20 | "rewriteTsconfig": false 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "globalDependencies": { 3 | "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2", 4 | "hammerjs": "github:DefinitelyTyped/DefinitelyTyped/hammerjs/hammerjs.d.ts#74a4dfc1bc2dfadec47b8aae953b28546cb9c6b7", 5 | "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c", 6 | "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#8cf8164641be73e8f1e652c2a5b967c7210b6729", 7 | "selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#a83677ed13add14c2ab06c7325d182d0ba2784ea", 8 | "webpack": "github:DefinitelyTyped/DefinitelyTyped/webpack/webpack.d.ts#95c02169ba8fa58ac1092422efbd2e3174a206f4" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'), 2 | path = require('path'); 3 | 4 | function root(args) { 5 | args = Array.prototype.slice.call(arguments, 0); 6 | return path.join.apply(path, [__dirname].concat(args)); 7 | } 8 | 9 | module.exports = { 10 | devtool: 'source-map', 11 | debug: true, 12 | entry: './app/boot.ts', 13 | resolve: { 14 | extensions: ['', '.ts', '.js'] 15 | }, 16 | output: { 17 | path: './build', 18 | filename: 'bundle.js' 19 | }, 20 | module: { 21 | preLoaders: [ 22 | { test: /\.js$/, loader: 'source-map-loader', exclude: [ root('node_modules/rxjs') ] } 23 | ], 24 | loaders: [ 25 | { test: /\.ts$/, loader: 'awesome-typescript-loader', exclude: [ /\.(spec|e2e)\.ts$/ ] }, 26 | { test: /\.(html|css)$/, loader: 'raw-loader' } 27 | ] 28 | }, 29 | devServer: { 30 | historyApiFallback: true 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /webpack.test.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'), 2 | path = require('path'); 3 | 4 | function root(args) { 5 | args = Array.prototype.slice.call(arguments, 0); 6 | return path.join.apply(path, [__dirname].concat(args)); 7 | } 8 | 9 | module.exports = { 10 | // the difference from the main webpack config 11 | // is that we have removed "debug", "entry", "output", and "devServer" configs 12 | // and moved the source map loader from "preloaders" to "loaders" 13 | devtool: 'inline-source-map', 14 | resolve: { 15 | extensions: ['', '.ts', '.js'] 16 | }, 17 | module: { 18 | loaders: [ 19 | { test: /\.js$/, loader: "source-map-loader", exclude: [ root('node_modules/rxjs') ]}, 20 | { test: /\.ts$/, loader: 'awesome-typescript-loader' }, 21 | { test: /\.(html|css)$/, loader: 'raw-loader' } 22 | ] 23 | } 24 | }; 25 | --------------------------------------------------------------------------------