├── src ├── app │ ├── home │ │ ├── home.css │ │ ├── index.ts │ │ ├── title │ │ │ ├── index.ts │ │ │ ├── title.service.ts │ │ │ └── title.spec.ts │ │ ├── x-large │ │ │ ├── index.ts │ │ │ ├── x-large.directive.ts │ │ │ └── x-large.spec.ts │ │ ├── home.e2e.ts │ │ ├── home.html │ │ ├── home.spec.ts │ │ └── home.component.ts │ ├── about │ │ ├── index.ts │ │ ├── about.spec.ts │ │ └── about.component.ts │ ├── router-active │ │ ├── index.ts │ │ └── router-active.directive.ts │ ├── index.ts │ ├── app.spec.ts │ ├── app.e2e.ts │ ├── app.service.ts │ └── app.component.ts ├── assets │ ├── css │ │ └── .gitkeep │ ├── mock-data │ │ ├── mock-orders.json │ │ ├── mock-data.json │ │ ├── mock-products.data.json │ │ └── mock-users.data.json │ ├── data.json │ ├── robots.txt │ ├── service-worker.js │ ├── icon │ │ ├── favicon.ico │ │ ├── apple-icon.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon-96x96.png │ │ ├── ms-icon-144x144.png │ │ ├── ms-icon-150x150.png │ │ ├── ms-icon-310x310.png │ │ ├── ms-icon-70x70.png │ │ ├── apple-icon-57x57.png │ │ ├── apple-icon-60x60.png │ │ ├── apple-icon-72x72.png │ │ ├── apple-icon-76x76.png │ │ ├── android-icon-144x144.png │ │ ├── android-icon-192x192.png │ │ ├── android-icon-36x36.png │ │ ├── android-icon-48x48.png │ │ ├── android-icon-72x72.png │ │ ├── android-icon-96x96.png │ │ ├── apple-icon-114x114.png │ │ ├── apple-icon-120x120.png │ │ ├── apple-icon-144x144.png │ │ ├── apple-icon-152x152.png │ │ ├── apple-icon-180x180.png │ │ ├── apple-icon-precomposed.png │ │ └── browserconfig.xml │ ├── img │ │ ├── angular-logo.png │ │ ├── angularclass-logo.png │ │ └── angularclass-avatar.png │ ├── humans.txt │ └── manifest.json ├── platform │ ├── browser │ │ ├── index.ts │ │ ├── pipes.ts │ │ ├── directives.ts │ │ ├── providers.ts │ │ └── angular2-material2 │ │ │ └── index.ts │ └── environment.ts ├── polyfills.ts ├── vendor.ts ├── main.browser.ts ├── index.html └── custom-typings.d.ts ├── karma.conf.js ├── webpack.config.js ├── protractor.conf.js ├── nitrous-post-create.sh ├── nitrous.json ├── .editorconfig ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── CONTRIBUTING.md └── ISSUE_TEMPLATE.md ├── typedoc.json ├── tsconfig.json ├── .gitignore ├── typings.json ├── LICENSE ├── config ├── protractor.conf.js ├── helpers.js ├── spec-bundle.js ├── karma.conf.js ├── webpack.dev.js ├── webpack.test.js ├── webpack.common.js └── webpack.prod.js ├── tslint.json ├── package.json └── README.md /src/app/home/home.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/css/.gitkeep: -------------------------------------------------------------------------------- 1 | @AngularClass 2 | -------------------------------------------------------------------------------- /src/assets/mock-data/mock-orders.json: -------------------------------------------------------------------------------- 1 | [ 2 | 3 | ] -------------------------------------------------------------------------------- /src/app/about/index.ts: -------------------------------------------------------------------------------- 1 | export * from './about.component'; 2 | -------------------------------------------------------------------------------- /src/app/home/index.ts: -------------------------------------------------------------------------------- 1 | export * from './home.component'; 2 | -------------------------------------------------------------------------------- /src/assets/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "value": "AngularClass" 3 | } 4 | -------------------------------------------------------------------------------- /src/app/home/title/index.ts: -------------------------------------------------------------------------------- 1 | export * from './title.service'; 2 | -------------------------------------------------------------------------------- /src/assets/robots.txt: -------------------------------------------------------------------------------- 1 | # robotstxt.org 2 | 3 | User-agent: * 4 | -------------------------------------------------------------------------------- /src/app/home/x-large/index.ts: -------------------------------------------------------------------------------- 1 | export * from './x-large.directive'; 2 | -------------------------------------------------------------------------------- /src/assets/mock-data/mock-data.json: -------------------------------------------------------------------------------- 1 | [ 2 | {"res": "data"} 3 | ] 4 | -------------------------------------------------------------------------------- /src/assets/service-worker.js: -------------------------------------------------------------------------------- 1 | // This file is intentionally without code. 2 | -------------------------------------------------------------------------------- /src/assets/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/favicon.ico -------------------------------------------------------------------------------- /src/app/router-active/index.ts: -------------------------------------------------------------------------------- 1 | // Application level directive 2 | export * from './router-active.directive'; 3 | -------------------------------------------------------------------------------- /src/assets/icon/apple-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon.png -------------------------------------------------------------------------------- /src/assets/img/angular-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/img/angular-logo.png -------------------------------------------------------------------------------- /src/assets/icon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/favicon-16x16.png -------------------------------------------------------------------------------- /src/assets/icon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/favicon-32x32.png -------------------------------------------------------------------------------- /src/assets/icon/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/favicon-96x96.png -------------------------------------------------------------------------------- /src/assets/icon/ms-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/ms-icon-144x144.png -------------------------------------------------------------------------------- /src/assets/icon/ms-icon-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/ms-icon-150x150.png -------------------------------------------------------------------------------- /src/assets/icon/ms-icon-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/ms-icon-310x310.png -------------------------------------------------------------------------------- /src/assets/icon/ms-icon-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/ms-icon-70x70.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-57x57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-57x57.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-60x60.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-72x72.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-76x76.png -------------------------------------------------------------------------------- /src/assets/img/angularclass-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/img/angularclass-logo.png -------------------------------------------------------------------------------- /src/platform/browser/index.ts: -------------------------------------------------------------------------------- 1 | export * from './directives'; 2 | export * from './pipes'; 3 | export * from './providers'; 4 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // @AngularClass 2 | // Look in config for karma.conf.js 3 | module.exports = require('./config/karma.conf.js'); 4 | -------------------------------------------------------------------------------- /src/assets/icon/android-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/android-icon-144x144.png -------------------------------------------------------------------------------- /src/assets/icon/android-icon-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/android-icon-192x192.png -------------------------------------------------------------------------------- /src/assets/icon/android-icon-36x36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/android-icon-36x36.png -------------------------------------------------------------------------------- /src/assets/icon/android-icon-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/android-icon-48x48.png -------------------------------------------------------------------------------- /src/assets/icon/android-icon-72x72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/android-icon-72x72.png -------------------------------------------------------------------------------- /src/assets/icon/android-icon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/android-icon-96x96.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-114x114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-114x114.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-120x120.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-144x144.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-152x152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-152x152.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-180x180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-180x180.png -------------------------------------------------------------------------------- /src/assets/img/angularclass-avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/img/angularclass-avatar.png -------------------------------------------------------------------------------- /src/assets/icon/apple-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timathon/sgz_v3/master/src/assets/icon/apple-icon-precomposed.png -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | // @AngularClass 2 | // Look in ./config folder for webpack.dev.js 3 | module.exports = require('./config/webpack.dev.js'); 4 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @AngularClass 2 | // look in ./config for protractor.conf.js 3 | exports.config = require('./config/protractor.conf.js').config; 4 | -------------------------------------------------------------------------------- /nitrous-post-create.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo 'Installing required NPM global packages...' 4 | npm install typings webpack-dev-server rimraf webpack -g --no-progress 5 | echo 'Installing NPM packages...' 6 | npm install --no-progress 7 | 8 | -------------------------------------------------------------------------------- /src/app/index.ts: -------------------------------------------------------------------------------- 1 | // App 2 | export * from './app.component'; 3 | export * from './app.service'; 4 | 5 | import {AppState} from './app.service'; 6 | 7 | // Application wide providers 8 | export const APP_PROVIDERS = [ 9 | AppState 10 | ]; 11 | -------------------------------------------------------------------------------- /src/assets/icon/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | #ffffff -------------------------------------------------------------------------------- /nitrous.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "angular2-webpack-starter", 3 | "description": "An Angular 2 Webpack Starter kit featuring Angular 2 (Router, Http, Forms, Services, Tests, E2E, Coverage), Karma, Protractor, Jasmine, Istanbul, TypeScript, and Webpack by AngularClass", 4 | "template": "nodejs", 5 | "ports": [3000] 6 | } 7 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /src/assets/humans.txt: -------------------------------------------------------------------------------- 1 | # humanstxt.org/ 2 | # The humans responsible & technology colophon 3 | 4 | # TEAM 5 | 6 | -- -- 7 | 8 | # THANKS 9 | 10 | 11 | PatrickJS -- @gdi2290 12 | AngularClass -- @AngularClass 13 | 14 | # TECHNOLOGY COLOPHON 15 | 16 | HTML5, CSS3 17 | Angular2, TypeScript, Webpack 18 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) 2 | 3 | 4 | 5 | * **What is the current behavior?** (You can also link to an open issue here) 6 | 7 | 8 | 9 | * **What is the new behavior (if this is a feature change)?** 10 | 11 | 12 | 13 | * **Other information**: 14 | -------------------------------------------------------------------------------- /src/platform/browser/pipes.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * These are globally available pipes in any template 3 | */ 4 | 5 | import {provide, PLATFORM_PIPES} from 'angular2/core'; 6 | 7 | // application_pipes: pipes that are global through out the application 8 | export const APPLICATION_PIPES = [ 9 | 10 | ]; 11 | 12 | export const PIPES = [ 13 | provide(PLATFORM_PIPES, {useValue: APPLICATION_PIPES, multi: true}) 14 | ]; 15 | -------------------------------------------------------------------------------- /typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "modules", 3 | "out": "doc", 4 | "theme": "default", 5 | "ignoreCompilerErrors": "true", 6 | "experimentalDecorators": "true", 7 | "emitDecoratorMetadata": "true", 8 | "target": "ES5", 9 | "moduleResolution": "node", 10 | "preserveConstEnums": "true", 11 | "stripInternal": "true", 12 | "suppressExcessPropertyErrors": "true", 13 | "suppressImplicitAnyIndexErrors": "true", 14 | "module": "commonjs" 15 | } 16 | -------------------------------------------------------------------------------- /src/app/home/title/title.service.ts: -------------------------------------------------------------------------------- 1 | import {Injectable} from 'angular2/core'; 2 | import {Http} from 'angular2/http'; 3 | 4 | @Injectable() 5 | export class Title { 6 | value = 'Angular 2'; 7 | constructor(public http: Http) { 8 | 9 | } 10 | 11 | getData() { 12 | console.log('Title#getData(): Get Data'); 13 | // return this.http.get('/assets/data.json') 14 | // .map(res => res.json()); 15 | return { 16 | value: 'AngularClass' 17 | }; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Read and contribute to the Wiki 2 | 3 | Make sure you read the Wiki 4 | https://github.com/AngularClass/angular2-webpack-starter/wiki 5 | 6 | ## Submitting Pull Requests 7 | If you're changing the structure of the repository please create an issue first 8 | 9 | ## Submitting bug reports 10 | 11 | Make sure you are on latest changes and that you ran this command `npm run clean:install` after updating your local repository. If you can, please provide more infomation about your environment such as browser, operating system, node version, and npm version -------------------------------------------------------------------------------- /src/assets/mock-data/mock-products.data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "name": "茶叶", 5 | "unit": "盒", 6 | "retailPrice": 40, 7 | "netValue": 28, 8 | "status": "active" 9 | }, 10 | { 11 | "id": 2, 12 | "name": "蛋白粉", 13 | "unit": "盒", 14 | "retailPrice": 30, 15 | "netValue": 21, 16 | "status": "active" 17 | }, 18 | { 19 | "id": 3, 20 | "name": "茶叶蛋白粉", 21 | "unit": "套", 22 | "retailPrice": 60, 23 | "netValue": 42, 24 | "subItems": [{"id": 1, "quantity": 1}, {"id": 2, "quantity": 1}], 25 | "status": "active" 26 | } 27 | ] -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | // Polyfills 2 | // (these modules are what are in 'angular2/bundles/angular2-polyfills' so don't use that here) 3 | 4 | // import 'ie-shim'; // Internet Explorer 5 | // import 'es6-shim'; 6 | // import 'es6-promise'; 7 | // import 'es7-reflect-metadata'; 8 | 9 | // Prefer CoreJS over the polyfills above 10 | import 'core-js'; 11 | require('zone.js/dist/zone'); 12 | 13 | if ('production' === ENV) { 14 | // Production 15 | 16 | 17 | } else { 18 | // Development 19 | 20 | Error.stackTraceLimit = Infinity; 21 | 22 | require('zone.js/dist/long-stack-trace-zone'); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/assets/mock-data/mock-users.data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": 1, 4 | "username": "siling", 5 | "password": "gogogo", 6 | "fullName": "司令", 7 | "pictureUrl": "www.sgztmz.com/siling/picture.jpg", 8 | "intro": "一人之上,万人之下", 9 | "upstream": "people", 10 | "mobile": 13312345678, 11 | "mobile1": 15512345678, 12 | "email": "siling@sgztmz.com", 13 | "wexin": "siling_sgz", 14 | "company": "长安市新中心投资股份有限公司", 15 | "url": "www.sgztmz.com/siling", 16 | "address": "长安市唐延中路888号A座8801室", 17 | "status": "active", 18 | "dateEntry": "2015-1-1", 19 | "dataExit": "" 20 | } 21 | ] -------------------------------------------------------------------------------- /src/app/app.spec.ts: -------------------------------------------------------------------------------- 1 | import { 2 | it, 3 | inject, 4 | injectAsync, 5 | beforeEachProviders, 6 | TestComponentBuilder 7 | } from 'angular2/testing'; 8 | 9 | // Load the implementations that should be tested 10 | import {App} from './app.component'; 11 | import {AppState} from './app.service'; 12 | 13 | describe('App', () => { 14 | // provide our implementations or mocks to the dependency injector 15 | beforeEachProviders(() => [ 16 | AppState, 17 | App 18 | ]); 19 | 20 | it('should have a url', inject([ App ], (app) => { 21 | expect(app.url).toEqual('https://twitter.com/AngularClass'); 22 | })); 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /src/app/home/home.e2e.ts: -------------------------------------------------------------------------------- 1 | describe('App', () => { 2 | 3 | beforeEach(() => { 4 | // change hash depending on router LocationStrategy 5 | browser.get('/#/home'); 6 | }); 7 | 8 | 9 | it('should have a title', () => { 10 | let subject = browser.getTitle(); 11 | let result = 'Angular2 Webpack Starter by @gdi2290 from @AngularClass'; 12 | expect(subject).toEqual(result); 13 | }); 14 | 15 | it('should have `your content here` x-large', () => { 16 | let subject = element(by.css('[x-large]')).getText(); 17 | let result = 'Your Content Here'; 18 | expect(subject).toEqual(result); 19 | }); 20 | 21 | 22 | }); 23 | -------------------------------------------------------------------------------- /src/platform/environment.ts: -------------------------------------------------------------------------------- 1 | // Angular 2 browser 2 | import { 3 | ELEMENT_PROBE_PROVIDERS, 4 | ELEMENT_PROBE_PROVIDERS_PROD_MODE 5 | } from 'angular2/platform/browser'; 6 | 7 | // Angular 2 8 | import {enableProdMode} from 'angular2/core'; 9 | 10 | // Environment Providers 11 | var PROVIDERS = []; 12 | 13 | if ('production' === ENV) { 14 | // Production 15 | enableProdMode(); 16 | 17 | PROVIDERS = [ 18 | ...PROVIDERS, 19 | ELEMENT_PROBE_PROVIDERS_PROD_MODE 20 | ]; 21 | 22 | } else { 23 | // Development 24 | PROVIDERS = [ 25 | ...PROVIDERS, 26 | ELEMENT_PROBE_PROVIDERS 27 | ]; 28 | 29 | } 30 | 31 | 32 | export const ENV_PROVIDERS = [ 33 | ...PROVIDERS 34 | ]; 35 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "module": "commonjs", 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "sourceMap": true 8 | }, 9 | "exclude": [ 10 | "node_modules", 11 | "typings/main.d.ts", 12 | "typings/main" 13 | ], 14 | "filesGlob": [ 15 | "./src/**/*.ts", 16 | "./test/**/*.ts", 17 | "!./node_modules/**/*.ts", 18 | "src/custom-typings.d.ts", 19 | "typings/browser.d.ts" 20 | ], 21 | "awesomeTypescriptLoaderOptions": { 22 | "resolveGlobs": true, 23 | "forkChecker": true 24 | }, 25 | "compileOnSave": false, 26 | "buildOnSave": false, 27 | "atom": { "rewriteTsconfig": false } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/home/x-large/x-large.directive.ts: -------------------------------------------------------------------------------- 1 | import {Directive, Component, ElementRef, Renderer} from 'angular2/core'; 2 | /* 3 | * Directive 4 | * XLarge is a simple directive to show how one is made 5 | */ 6 | @Directive({ 7 | selector: '[x-large]' // using [ ] means selecting attributes 8 | }) 9 | export class XLarge { 10 | constructor(element: ElementRef, renderer: Renderer) { 11 | // simple DOM manipulation to set font size to x-large 12 | // `nativeElement` is the direct reference to the DOM element 13 | // element.nativeElement.style.fontSize = 'x-large'; 14 | 15 | // for server/webworker support use the renderer 16 | renderer.setElementStyle(element.nativeElement, 'fontSize', 'x-large'); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/platform/browser/directives.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * These are globally available directives in any template 3 | */ 4 | 5 | import {provide, PLATFORM_DIRECTIVES} from 'angular2/core'; 6 | 7 | // Angular 2 Router 8 | import {ROUTER_DIRECTIVES} from 'angular2/router'; 9 | 10 | // Angular 2 Material 2 11 | // TODO(gdi2290): replace with @angular2-material/all 12 | import {MATERIAL_DIRECTIVES} from './angular2-material2'; 13 | 14 | // application_directives: directives that are global through out the application 15 | export const APPLICATION_DIRECTIVES = [ 16 | ...ROUTER_DIRECTIVES, 17 | ...MATERIAL_DIRECTIVES, 18 | ]; 19 | 20 | export const DIRECTIVES = [ 21 | provide(PLATFORM_DIRECTIVES, {useValue: APPLICATION_DIRECTIVES, multi: true}) 22 | ]; 23 | -------------------------------------------------------------------------------- /src/app/about/about.spec.ts: -------------------------------------------------------------------------------- 1 | import { 2 | it, 3 | inject, 4 | injectAsync, 5 | describe, 6 | beforeEachProviders, 7 | TestComponentBuilder 8 | } from 'angular2/testing'; 9 | 10 | import {Component, provide} from 'angular2/core'; 11 | 12 | // Load the implementations that should be tested 13 | import {About} from './about.component'; 14 | 15 | describe('About', () => { 16 | // provide our implementations or mocks to the dependency injector 17 | beforeEachProviders(() => [ 18 | About 19 | ]); 20 | 21 | it('should log ngOnInit', inject([ About ], (about) => { 22 | spyOn(console, 'log'); 23 | expect(console.log).not.toHaveBeenCalled(); 24 | 25 | about.ngOnInit(); 26 | expect(console.log).toHaveBeenCalled(); 27 | })); 28 | 29 | }); 30 | -------------------------------------------------------------------------------- /src/app/app.e2e.ts: -------------------------------------------------------------------------------- 1 | describe('App', () => { 2 | 3 | beforeEach(() => { 4 | browser.get('/'); 5 | }); 6 | 7 | 8 | it('should have a title', () => { 9 | let subject = browser.getTitle(); 10 | let result = 'Angular2 Webpack Starter by @gdi2290 from @AngularClass'; 11 | expect(subject).toEqual(result); 12 | }); 13 | 14 | it('should have
', () => { 15 | let subject = element(by.css('app header')).isPresent(); 16 | let result = true; 17 | expect(subject).toEqual(result); 18 | }); 19 | 20 | it('should have
', () => { 21 | let subject = element(by.css('app main')).isPresent(); 22 | let result = true; 23 | expect(subject).toEqual(result); 24 | }); 25 | 26 | it('should have