14 |
15 |
16 |
17 | `,
18 | directives: [ROUTER_DIRECTIVES]
19 | })
20 | @RouteConfig([
21 | { path: '/detail/...', component: UserDetail, name: 'UserDetail', useAsDefault: true }
22 | ])
23 | export class Users {
24 | userLogin: Object;
25 |
26 | constructor(params: RouteParams) {
27 | this.userLogin = params.get('userLogin');
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/assets/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "App",
3 | "icons": [
4 | {
5 | "src": "/assets/icon/android-icon-36x36.png",
6 | "sizes": "36x36",
7 | "type": "image/png",
8 | "density": 0.75
9 | },
10 | {
11 | "src": "/assets/icon/android-icon-48x48.png",
12 | "sizes": "48x48",
13 | "type": "image/png",
14 | "density": 1.0
15 | },
16 | {
17 | "src": "/assets/icon/android-icon-72x72.png",
18 | "sizes": "72x72",
19 | "type": "image/png",
20 | "density": 1.5
21 | },
22 | {
23 | "src": "/assets/icon/android-icon-96x96.png",
24 | "sizes": "96x96",
25 | "type": "image/png",
26 | "density": 2.0
27 | },
28 | {
29 | "src": "/assets/icon/android-icon-144x144.png",
30 | "sizes": "144x144",
31 | "type": "image/png",
32 | "density": 3.0
33 | },
34 | {
35 | "src": "/assets/icon/android-icon-192x192.png",
36 | "sizes": "192x192",
37 | "type": "image/png",
38 | "density": 4.0
39 | }
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Providers provided by Angular
3 | */
4 | import {provide} from 'angular2/core';
5 | import {bootstrap, ELEMENT_PROBE_PROVIDERS} from 'angular2/platform/browser';
6 | import {ROUTER_PROVIDERS, LocationStrategy, PathLocationStrategy} from 'angular2/router';
7 | import {HTTP_PROVIDERS} from 'angular2/http';
8 |
9 | /*
10 | * App Component
11 | * our top level component that holds all of our components
12 | */
13 | import {App} from './app/app';
14 | /*
15 | * Bootstrap our Angular app with a top level component `App` and inject
16 | * our Services and Providers into Angular's dependency injection
17 | */
18 | document.addEventListener('DOMContentLoaded', function main() {
19 | bootstrap(App, [
20 | ...('production' === process.env.ENV ? [] : ELEMENT_PROBE_PROVIDERS),
21 | ...HTTP_PROVIDERS,
22 | ...ROUTER_PROVIDERS,
23 | provide(LocationStrategy, { useClass: PathLocationStrategy })
24 | ])
25 | .catch(err => console.error(err));
26 | });
27 |
--------------------------------------------------------------------------------
/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // @AngularClass
2 |
3 | exports.config = {
4 | baseUrl: 'http://localhost:3000/',
5 |
6 | specs: [
7 | 'test/**/*.e2e.js'
8 | ],
9 | exclude: [],
10 |
11 | framework: 'jasmine',
12 |
13 | allScriptsTimeout: 110000,
14 |
15 | jasmineNodeOpts: {
16 | showTiming: true,
17 | showColors: true,
18 | isVerbose: false,
19 | includeStackTrace: false,
20 | defaultTimeoutInterval: 400000
21 | },
22 | directConnect: true,
23 |
24 | capabilities: {
25 | 'browserName': 'chrome',
26 | 'chromeOptions': {
27 | 'args': ['show-fps-counter=true']
28 | }
29 | },
30 |
31 | onPrepare: function() {
32 | browser.ignoreSynchronization = true;
33 | },
34 |
35 |
36 | /**
37 | * Angular 2 configuration
38 | *
39 | * useAllAngular2AppRoots: tells Protractor to wait for any angular2 apps on the page instead of just the one matching
40 | * `rootEl`
41 | *
42 | */
43 | useAllAngular2AppRoots: true
44 | };
45 |
--------------------------------------------------------------------------------
/src/vendor.ts:
--------------------------------------------------------------------------------
1 | // Polyfills
2 | import 'es6-shim';
3 | // (these modules are what are in 'angular2/bundles/angular2-polyfills' so don't use that here)
4 | import 'es6-promise';
5 | import 'zone.js/lib/browser/zone-microtask';
6 |
7 | if ('production' !== process.env.ENV) {
8 | // Reflect Polyfill
9 | require('es7-reflect-metadata/dist/browser');
10 | Error['stackTraceLimit'] = Infinity;
11 | Zone['longStackTraceZone'] = require('zone.js/lib/zones/long-stack-trace.js');
12 | }
13 |
14 | if ('production' === process.env.ENV) {
15 | // Reflect with es7-reflect-metadata/reflect-metadata is added
16 | // by webpack.prod.config ProvidePlugin
17 | let ngCore = require('angular2/core');
18 | ngCore.enableProdMode();
19 | }
20 | // Angular 2
21 | import 'angular2/platform/browser';
22 | import 'angular2/platform/common_dom';
23 | import 'angular2/router';
24 | import 'angular2/http';
25 | import 'angular2/core';
26 |
27 | // RxJS
28 | import 'rxjs';
29 |
30 | // Other vendors for example jQuery, Lodash, angular2-jwt
31 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # @AngularClass
2 |
3 | # Logs
4 | logs
5 | *.log
6 |
7 | # Runtime data
8 | pids
9 | *.pid
10 | *.seed
11 |
12 | # Directory for instrumented libs generated by jscoverage/JSCover
13 | lib-cov
14 |
15 | # Coverage directory used by tools like istanbul
16 | coverage
17 |
18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
19 | .grunt
20 |
21 | # Compiled binary addons (http://nodejs.org/api/addons.html)
22 | build/Release
23 |
24 | # Users Environment Variables
25 | .lock-wscript
26 |
27 | # OS generated files #
28 | .DS_Store
29 | ehthumbs.db
30 | Icon?
31 | Thumbs.db
32 |
33 | # Node Files #
34 | /node_modules
35 | /bower_components
36 |
37 | # Coverage #
38 | /coverage/
39 |
40 | # Typing #
41 | /src/typings/tsd/
42 | /typings/
43 | /tsd_typings/
44 |
45 | # Dist #
46 | /dist
47 | /public/__build__/
48 | /src/*/__build__/
49 | /__build__/**
50 | /public/dist/
51 | /src/*/dist/
52 | /dist/**
53 | .webpack.json
54 |
55 | # Doc #
56 | /doc/
57 |
58 | # IDE #
59 | .idea/
60 | *.swp
61 |
--------------------------------------------------------------------------------
/test/app/app.e2e.js:
--------------------------------------------------------------------------------
1 | /*
2 | * TODO: ES5 for now until I make a webpack plugin for protractor
3 | */
4 | describe('App', function() {
5 |
6 | beforeEach(function() {
7 | browser.get('/');
8 | });
9 |
10 |
11 | it('should have a title', function() {
12 | var subject = browser.getTitle();
13 | var result = 'Angular2 Webpack Starter by @gdi2990 from @AngularClass';
14 | expect(subject).toEqual(result);
15 | });
16 |
17 | it('should have
', function() {
18 | var subject = element(by.deepCss('app /deep/ header')).isPresent();
19 | var result = true;
20 | expect(subject).toEqual(result);
21 | });
22 |
23 | it('should have ', function() {
24 | var subject = element(by.deepCss('app /deep/ main')).isPresent();
25 | var result = true;
26 | expect(subject).toEqual(result);
27 | });
28 |
29 | it('should have