Authored by Anderson Dsouza

Initial code push.

  1 +# http://editorconfig.org
  2 +root = true
  3 +
  4 +[*]
  5 +charset = utf-8
  6 +indent_style = space
  7 +indent_size = 2
  8 +insert_final_newline = true
  9 +trim_trailing_whitespace = true
  10 +
  11 +
  12 +[*.md]
  13 +max_line_length = 0
  14 +trim_trailing_whitespace = false
  15 +
  16 +# Indentation override
  17 +#[lib/**.js]
  18 +#[{package.json,.travis.yml}]
  19 +#[**/**.js]
  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 +
  44 +.vscode
  1 +{
  2 + "server": {
  3 + "baseDir": "src",
  4 + "routes": {
  5 + "/node_modules": "node_modules"
  6 + }
  7 + }
  8 +}
  1 +{
  2 + "name": "angular-quickstart",
  3 + "version": "1.0.0",
  4 + "description": "QuickStart package.json from the documentation, supplemented with testing support",
  5 + "scripts": {
  6 + "build": "tsc -p src/",
  7 + "build:watch": "tsc -p src/ -w",
  8 + "build:e2e": "tsc -p e2e/",
  9 + "serve": "lite-server -c=bs-config.json",
  10 + "serve:e2e": "lite-server -c=bs-config.e2e.json",
  11 + "prestart": "npm run build",
  12 + "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
  13 + "pree2e": "npm run build:e2e",
  14 + "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
  15 + "preprotractor": "webdriver-manager update",
  16 + "protractor": "protractor protractor.config.js",
  17 + "pretest": "npm run build",
  18 + "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
  19 + "pretest:once": "npm run build",
  20 + "test:once": "karma start karma.conf.js --single-run",
  21 + "lint": "tslint ./src/**/*.ts -t verbose"
  22 + },
  23 + "keywords": [],
  24 + "author": "",
  25 + "license": "MIT",
  26 + "dependencies": {
  27 + "@angular/common": "~4.0.0",
  28 + "@angular/compiler": "~4.0.0",
  29 + "@angular/core": "~4.0.0",
  30 + "@angular/forms": "~4.0.0",
  31 + "@angular/http": "~4.0.0",
  32 + "@angular/platform-browser": "~4.0.0",
  33 + "@angular/platform-browser-dynamic": "~4.0.0",
  34 + "@angular/router": "~4.0.0",
  35 +
  36 + "angular-in-memory-web-api": "~0.3.0",
  37 + "systemjs": "0.19.40",
  38 + "core-js": "^2.4.1",
  39 + "rxjs": "5.0.1",
  40 + "zone.js": "^0.8.4"
  41 + },
  42 + "devDependencies": {
  43 + "concurrently": "^3.2.0",
  44 + "lite-server": "^2.2.2",
  45 + "typescript": "~2.1.0",
  46 +
  47 + "canonical-path": "0.0.2",
  48 + "tslint": "^3.15.1",
  49 + "lodash": "^4.16.4",
  50 + "jasmine-core": "~2.4.1",
  51 + "karma": "^1.3.0",
  52 + "karma-chrome-launcher": "^2.0.0",
  53 + "karma-cli": "^1.0.1",
  54 + "karma-jasmine": "^1.0.2",
  55 + "karma-jasmine-html-reporter": "^0.2.2",
  56 + "protractor": "~4.0.14",
  57 + "rimraf": "^2.5.4",
  58 +
  59 + "@types/node": "^6.0.46",
  60 + "@types/jasmine": "2.5.36"
  61 + },
  62 + "repository": {}
  63 +}
  1 +h1 {
  2 + font-size: 1.2em;
  3 + color:red;
  4 + margin-bottom: 0;
  5 + }
  6 + .heroes {
  7 + margin: 0 0 2em 0;
  8 + list-style-type: none;
  9 + padding: 0;
  10 + width: 15em;
  11 + }
  12 + .selected {
  13 + background-color: #CFD8DC !important;
  14 + color: white;
  15 + }
  16 + .heroes {
  17 + margin: 0 0 2em 0;
  18 + list-style-type: none;
  19 + padding: 0;
  20 + width: 15em;
  21 + }
  22 + .heroes li {
  23 + cursor: pointer;
  24 + position: relative;
  25 + left: 0;
  26 + background-color: #EEE;
  27 + margin: .5em;
  28 + padding: .3em 0;
  29 + height: 1.6em;
  30 + border-radius: 4px;
  31 + }
  32 + .heroes li.selected:hover {
  33 + background-color: #BBD8DC !important;
  34 + color: white;
  35 + }
  36 + .heroes li:hover {
  37 + color: #607D8B;
  38 + background-color: #DDD;
  39 + left: .1em;
  40 + }
  41 + .heroes .text {
  42 + position: relative;
  43 + top: -3px;
  44 + }
  45 + .heroes .badge {
  46 + display: inline-block;
  47 + font-size: small;
  48 + color: white;
  49 + padding: 0.8em 0.7em 0 0.7em;
  50 + background-color: #607D8B;
  51 + line-height: 1em;
  52 + position: relative;
  53 + left: -1px;
  54 + top: -4px;
  55 + height: 1.8em;
  56 + margin-right: .8em;
  57 + border-radius: 4px 0 0 4px;
  58 + }
  1 +<h1>{{title}}</h1>
  2 +<div><label>Id: </label>{{hero.id}}</div>
  3 +<div><label>Name: </label>{{hero.name}}</div>
  4 +
  5 +<!--One-way binding-->
  6 +<h1>One-way binding</h1>
  7 +<div>
  8 +<input [value]="hero.name">
  9 +</div>
  10 +
  11 +<!--Two-way binding-->
  12 +<h1>Two-way binding</h1>
  13 +<div>
  14 + <label>name: </label>
  15 + <input [(ngModel)]="hero.name" placeholder="name">
  16 +
  17 +</div>
  18 +
  19 +<!--ngFor Example-->
  20 +<!--<h1>ngFor</h1>
  21 +<h2>My Heroes</h2>
  22 +<ul class="heroes">
  23 + <li *ngFor="let hero of heroes">
  24 + <span class="badge">{{hero.id}}</span> {{hero.name}}
  25 + </li>
  26 +</ul>-->
  27 +
  28 +<!--Handling Events-->
  29 +<h1>ngFor with Event handling</h1>
  30 +<h2>My Heroes</h2>
  31 +<ul class="heroes">
  32 + <li *ngFor="let hero of heroes" (click)="onSelect(hero)">
  33 + <span class="badge">{{hero.id}}</span> {{hero.name}}
  34 + </li>
  35 +</ul>
  36 +
  37 +<!--ngIf-->
  38 +<!--<div *ngIf="selectedHero">
  39 + <label>name: </label>
  40 + <input [(ngModel)]="selectedHero.name" placeholder="name">
  41 +</div>-->
  42 +
  43 +<!--Multiple Components-->
  44 +<hero-detail [hero]="selectedHero"></hero-detail>
  1 +"use strict";
  2 +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3 + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4 + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5 + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6 + return c > 3 && r && Object.defineProperty(target, key, r), r;
  7 +};
  8 +var __metadata = (this && this.__metadata) || function (k, v) {
  9 + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10 +};
  11 +var core_1 = require("@angular/core");
  12 +var hero_service_1 = require("./services/hero.service");
  13 +var AppComponent = (function () {
  14 + // constructor(private heroService: HeroService){
  15 + // // this.heroes=heroService.getHeroes();
  16 + // // Async services and Promises
  17 + // this.heroService.getHeroesSlowly().then(heroes => this.heroes = heroes);
  18 + // }
  19 + // //ngOnInit
  20 + function AppComponent(heroService) {
  21 + this.heroService = heroService;
  22 + this.name = 'Angular1';
  23 + this.hero = { id: 1, name: 'Anderson' };
  24 + }
  25 + AppComponent.prototype.ngOnInit = function () {
  26 + this.getHeroes();
  27 + };
  28 + AppComponent.prototype.getHeroes = function () {
  29 + // this.heroService.getHeroes().then(heroes => this.heroes = heroes);
  30 + var _this = this;
  31 + //Simulate server latency
  32 + // this.heroService.getHeroesSlowly().then(heroes => this.heroes = heroes);
  33 + this.heroService.getHeroes().then(function (heroes) { return _this.heroes = heroes; });
  34 + };
  35 + AppComponent.prototype.onSelect = function (hero) {
  36 + this.selectedHero = hero;
  37 + // alert(this.selectedHero.name);
  38 + };
  39 + return AppComponent;
  40 +}());
  41 +AppComponent = __decorate([
  42 + core_1.Component({
  43 + selector: 'my-app',
  44 + // template: `<h1>Hello1 {{name}}</h1>`,
  45 + templateUrl: 'app/app.component.html',
  46 + styleUrls: ['app/app.component.css'],
  47 + providers: [hero_service_1.HeroService]
  48 + }),
  49 + __metadata("design:paramtypes", [hero_service_1.HeroService])
  50 +], AppComponent);
  51 +exports.AppComponent = AppComponent;
  52 +//# sourceMappingURL=app.component.js.map
  1 +{"version":3,"file":"app.component.js","sourceRoot":"","sources":["app.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAiD;AAEjD,wDAAmD;AAYnD,IAAa,YAAY;IAazB,mDAAmD;IACnD,+CAA+C;IAE/C,sCAAsC;IACtC,+EAA+E;IAC/E,MAAM;IAEN,aAAa;IACX,sBAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;QApB5C,SAAI,GAAG,UAAU,CAAC;QAClB,SAAI,GAAQ,EAAC,EAAE,EAAC,CAAC,EAAE,IAAI,EAAC,UAAU,EAAC,CAAC;IAoBpC,CAAC;IAED,+BAAQ,GAAR;QACG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpB,CAAC;IACF,gCAAS,GAAT;QACG,qEAAqE;QADxE,iBAOE;QAJC,yBAAyB;QACzB,2EAA2E;QAE3E,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAA,MAAM,IAAI,OAAA,KAAI,CAAC,MAAM,GAAG,MAAM,EAApB,CAAoB,CAAC,CAAC;IACpE,CAAC;IAGD,+BAAQ,GAAR,UAAS,IAAU;QACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,iCAAiC;IACnC,CAAC;IACH,mBAAC;AAAD,CAAC,AAzCD,IAyCC;AAzCY,YAAY;IARxB,gBAAS,CAAC;QACT,QAAQ,EAAE,QAAQ;QAClB,wCAAwC;QACxC,WAAW,EAAE,wBAAwB;QAErC,SAAS,EAAC,CAAC,uBAAuB,CAAC;QAClC,SAAS,EAAE,CAAC,0BAAW,CAAC;KAC1B,CAAC;qCAsBiC,0BAAW;GArBjC,YAAY,CAyCxB;AAzCY,oCAAY"}
  1 +import { Component,OnInit } from '@angular/core';
  2 +import {Hero} from './models/hero'
  3 +import {HeroService} from './services/hero.service'
  4 +import { HttpModule } from '@angular/http';
  5 +
  6 +
  7 +@Component({
  8 + selector: 'my-app',
  9 + // template: `<h1>Hello1 {{name}}</h1>`,
  10 + templateUrl: 'app/app.component.html',
  11 +
  12 + styleUrls:['app/app.component.css'],
  13 + providers: [HeroService]
  14 +})
  15 +export class AppComponent {
  16 + name = 'Angular1';
  17 + hero: Hero ={id:1, name:'Anderson'};
  18 +// heroes: Hero[];
  19 +
  20 +// constructor(){
  21 +// var heroService = new HeroService();
  22 +// this.heroes=heroService.getHeroes();
  23 +// }
  24 +
  25 +//Service Demo with DI
  26 + heroes: Hero[];
  27 +
  28 +// constructor(private heroService: HeroService){
  29 +// // this.heroes=heroService.getHeroes();
  30 +
  31 +// // Async services and Promises
  32 +// this.heroService.getHeroesSlowly().then(heroes => this.heroes = heroes);
  33 +// }
  34 +
  35 +// //ngOnInit
  36 + constructor(private heroService: HeroService) {
  37 + }
  38 +
  39 + ngOnInit(): void {
  40 + this.getHeroes();
  41 + }
  42 + getHeroes(): void {
  43 + // this.heroService.getHeroes().then(heroes => this.heroes = heroes);
  44 +
  45 + //Simulate server latency
  46 + // this.heroService.getHeroesSlowly().then(heroes => this.heroes = heroes);
  47 +
  48 + this.heroService.getHeroes().then(heroes => this.heroes = heroes);
  49 + }
  50 + // Event Handling
  51 + selectedHero: Hero;
  52 + onSelect(hero: Hero): void {
  53 + this.selectedHero = hero;
  54 + // alert(this.selectedHero.name);
  55 + }
  56 +}
  1 +"use strict";
  2 +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3 + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4 + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5 + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6 + return c > 3 && r && Object.defineProperty(target, key, r), r;
  7 +};
  8 +var core_1 = require("@angular/core");
  9 +var platform_browser_1 = require("@angular/platform-browser");
  10 +var forms_1 = require("@angular/forms");
  11 +//Http Service
  12 +var http_1 = require("@angular/http");
  13 +var app_component_1 = require("./app.component");
  14 +var hero_detail_component_1 = require("./hero-detail/hero-detail.component");
  15 +// Imports for loading & configuring the in-memory web api
  16 +var angular_in_memory_web_api_1 = require("angular-in-memory-web-api");
  17 +var in_memory_data_service_1 = require("./services/mocks/in-memory-data.service");
  18 +var AppModule = (function () {
  19 + function AppModule() {
  20 + }
  21 + return AppModule;
  22 +}());
  23 +AppModule = __decorate([
  24 + core_1.NgModule({
  25 + imports: [platform_browser_1.BrowserModule,
  26 + //Http Service
  27 + http_1.HttpModule,
  28 + forms_1.FormsModule,
  29 + angular_in_memory_web_api_1.InMemoryWebApiModule.forRoot(in_memory_data_service_1.InMemoryDataService)],
  30 + declarations: [app_component_1.AppComponent,
  31 + hero_detail_component_1.HeroDetailComponent],
  32 + bootstrap: [app_component_1.AppComponent]
  33 + })
  34 +], AppModule);
  35 +exports.AppModule = AppModule;
  36 +//# sourceMappingURL=app.module.js.map
  1 +{"version":3,"file":"app.module.js","sourceRoot":"","sources":["app.module.ts"],"names":[],"mappings":";;;;;;;AAAA,sCAA8C;AAC9C,8DAA0D;AAC1D,wCAA6C;AAE7C,cAAc;AACd,sCAA8C;AAE9C,iDAAgD;AAChD,6EAA2E;AAE3E,0DAA0D;AAC1D,uEAAiE;AACjE,kFAA+E;AAa/E,IAAa,SAAS;IAAtB;IAAyB,CAAC;IAAD,gBAAC;AAAD,CAAC,AAA1B,IAA0B;AAAb,SAAS;IAXrB,eAAQ,CAAC;QACR,OAAO,EAAO,CAAE,gCAAa;YAC7B,cAAc;YACd,iBAAU;YACV,mBAAW;YACX,gDAAoB,CAAC,OAAO,CAAC,4CAAmB,CAAC,CAAC;QAClD,YAAY,EAAE,CAAE,4BAAY;YACtB,2CAAmB,CAAE;QAC3B,SAAS,EAAK,CAAE,4BAAY,CAAE;KAE/B,CAAC;GACW,SAAS,CAAI;AAAb,8BAAS"}
  1 +import { NgModule } from '@angular/core';
  2 +import { BrowserModule } from '@angular/platform-browser';
  3 +import { FormsModule } from '@angular/forms';
  4 +
  5 +//Http Service
  6 +import { HttpModule } from '@angular/http';
  7 +
  8 +import { AppComponent } from './app.component';
  9 +import { HeroDetailComponent } from './hero-detail/hero-detail.component';
  10 +
  11 +// Imports for loading & configuring the in-memory web api
  12 +import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
  13 +import { InMemoryDataService } from './services/mocks/in-memory-data.service';
  14 +
  15 +@NgModule({
  16 + imports: [ BrowserModule ,
  17 + //Http Service
  18 + HttpModule,
  19 + FormsModule,
  20 + InMemoryWebApiModule.forRoot(InMemoryDataService)],
  21 + declarations: [ AppComponent,
  22 + HeroDetailComponent ],
  23 + bootstrap: [ AppComponent ]
  24 +
  25 +})
  26 +export class AppModule { }
  1 +<div *ngIf="hero">
  2 + <label>name: </label>
  3 + <input [(ngModel)]="hero.name" placeholder="name">
  4 +</div>
  1 +"use strict";
  2 +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3 + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4 + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5 + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6 + return c > 3 && r && Object.defineProperty(target, key, r), r;
  7 +};
  8 +var __metadata = (this && this.__metadata) || function (k, v) {
  9 + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10 +};
  11 +var core_1 = require("@angular/core");
  12 +var hero_1 = require("../models/hero");
  13 +var HeroDetailComponent = (function () {
  14 + function HeroDetailComponent() {
  15 + }
  16 + return HeroDetailComponent;
  17 +}());
  18 +__decorate([
  19 + core_1.Input(),
  20 + __metadata("design:type", hero_1.Hero)
  21 +], HeroDetailComponent.prototype, "hero", void 0);
  22 +HeroDetailComponent = __decorate([
  23 + core_1.Component({
  24 + selector: 'hero-detail',
  25 + // template: `
  26 + // <div *ngIf="hero">
  27 + // <h2>{{hero.name}} details!</h2>
  28 + // <div><label>id: </label>{{hero.id}}</div>
  29 + // <div>
  30 + // <label>name: </label>
  31 + // <input [(ngModel)]="hero.name" placeholder="name"/>
  32 + // </div>
  33 + // </div>
  34 + // `,
  35 + templateUrl: './hero-detail.component.html',
  36 + styleUrls: ['./hero-detail.component.css']
  37 + })
  38 +], HeroDetailComponent);
  39 +exports.HeroDetailComponent = HeroDetailComponent;
  40 +//# sourceMappingURL=hero-detail.component.js.map
  1 +{"version":3,"file":"hero-detail.component.js","sourceRoot":"","sources":["hero-detail.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAAgD;AAChD,uCAAqC;AAkBrC,IAAa,mBAAmB;IAAhC;IAEC,CAAC;IAAD,0BAAC;AAAD,CAAC,AAFF,IAEE;AADS;IAAR,YAAK,EAAE;8BAAO,WAAI;iDAAC;AADT,mBAAmB;IAhB/B,gBAAS,CAAC;QACT,QAAQ,EAAE,aAAa;QACzB,gBAAgB;QAChB,yBAAyB;QACzB,wCAAwC;QACxC,kDAAkD;QAClD,cAAc;QACd,gCAAgC;QAChC,8DAA8D;QAC9D,eAAe;QACf,aAAa;QACb,OAAO;QACJ,WAAW,EAAC,8BAA8B;QAE3C,SAAS,EAAC,CAAC,6BAA6B,CAAC;KAC1C,CAAC;GACW,mBAAmB,CAE9B;AAFW,kDAAmB"}
  1 +import { Component,Input } from '@angular/core';
  2 +import {Hero } from '../models/hero';
  3 +
  4 +@Component({
  5 + selector: 'hero-detail',
  6 +// template: `
  7 +// <div *ngIf="hero">
  8 +// <h2>{{hero.name}} details!</h2>
  9 +// <div><label>id: </label>{{hero.id}}</div>
  10 +// <div>
  11 +// <label>name: </label>
  12 +// <input [(ngModel)]="hero.name" placeholder="name"/>
  13 +// </div>
  14 +// </div>
  15 +// `,
  16 + templateUrl:'./hero-detail.component.html',
  17 +
  18 + styleUrls:['./hero-detail.component.css']
  19 +})
  20 +export class HeroDetailComponent {
  21 + @Input() hero: Hero;
  22 + }
  1 +//# sourceMappingURL=hero-detail.component.js.map
  1 +{"version":3,"file":"hero-detail.component.js","sourceRoot":"","sources":["hero-detail.component.ts"],"names":[],"mappings":""}
  1 +"use strict";
  2 +var Hero = (function () {
  3 + function Hero() {
  4 + }
  5 + return Hero;
  6 +}());
  7 +exports.Hero = Hero;
  8 +//# sourceMappingURL=hero.js.map
  1 +{"version":3,"file":"hero.js","sourceRoot":"","sources":["hero.ts"],"names":[],"mappings":";AAAA;IAAA;IAGA,CAAC;IAAD,WAAC;AAAD,CAAC,AAHD,IAGC;AAHY,oBAAI"}
  1 +export class Hero {
  2 + id: number;
  3 + name: string;
  4 +}
  5 +
  1 +"use strict";
  2 +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3 + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4 + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5 + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6 + return c > 3 && r && Object.defineProperty(target, key, r), r;
  7 +};
  8 +var __metadata = (this && this.__metadata) || function (k, v) {
  9 + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  10 +};
  11 +var core_1 = require("@angular/core");
  12 +//HTTP Service
  13 +var http_1 = require("@angular/http");
  14 +require("rxjs/add/operator/toPromise");
  15 +// @Injectable()
  16 +// export class HeroService {
  17 +// getHeroes(): Hero[] {
  18 +// return HEROES;
  19 +// }
  20 +// }
  21 +// Async services and Promises
  22 +var HeroService = (function () {
  23 + function HeroService(http) {
  24 + this.http = http;
  25 + // getHeroes(): Promise<Hero[]> {
  26 + // return Promise.resolve(HEROES);
  27 + // }
  28 + // getHeroesSlowly(): Promise<Hero[]> {
  29 + // return new Promise(resolve => {
  30 + // // Simulate server latency with 2 second delay
  31 + // setTimeout(() => resolve(this.getHeroes()), 2000);
  32 + // });
  33 + // }
  34 + //HTTP service
  35 + // private heroesUrl = './mocks/in-memory-data.service'; // URL to web api
  36 + this.heroesUrl = 'api/heroes'; // URL to web api
  37 + }
  38 + HeroService.prototype.getHeroes = function () {
  39 + return this.http.get(this.heroesUrl)
  40 + .toPromise()
  41 + .then(function (response) { return response.json().data; })
  42 + .catch(this.handleError);
  43 + };
  44 + HeroService.prototype.handleError = function (error) {
  45 + console.error('An error occurred', error); // for demo purposes only
  46 + return Promise.reject(error.message || error);
  47 + };
  48 + return HeroService;
  49 +}());
  50 +HeroService = __decorate([
  51 + core_1.Injectable(),
  52 + __metadata("design:paramtypes", [http_1.Http])
  53 +], HeroService);
  54 +exports.HeroService = HeroService;
  55 +//# sourceMappingURL=hero.service.js.map
  1 +{"version":3,"file":"hero.service.js","sourceRoot":"","sources":["hero.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sCAA2C;AAE3C,cAAc;AACd,sCAA8C;AAC9C,uCAAqC;AAKrC,gBAAgB;AAChB,6BAA6B;AAC7B,0BAA0B;AAC1B,qBAAqB;AACrB,MAAM;AACN,IAAI;AAEJ,+BAA+B;AAE/B,IAAa,WAAW;IAetB,qBAAoB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;QAdhC,mCAAmC;QACnC,sCAAsC;QACtC,MAAM;QAEN,yCAAyC;QACzC,oCAAoC;QACpC,qDAAqD;QACrD,yDAAyD;QACzD,QAAQ;QACR,IAAI;QAEJ,cAAc;QACd,2EAA2E;QACnE,cAAS,GAAG,YAAY,CAAC,CAAE,iBAAiB;IAChB,CAAC;IACnC,+BAAS,GAAT;QACE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;aACxB,SAAS,EAAE;aACX,IAAI,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAc,EAA9B,CAA8B,CAAC;aAChD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IACO,iCAAW,GAAnB,UAAoB,KAAU;QAC5B,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC,CAAC,yBAAyB;QACpE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC;IAChD,CAAC;IACH,kBAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,WAAW;IADvB,iBAAU,EAAE;qCAgBe,WAAI;GAfnB,WAAW,CA0BvB;AA1BY,kCAAW"}
  1 +import { Injectable } from '@angular/core';
  2 +
  3 +//HTTP Service
  4 +import { Headers, Http } from '@angular/http';
  5 +import 'rxjs/add/operator/toPromise';
  6 +
  7 +import { Hero } from '../models/hero';
  8 +import { HEROES } from './mocks/mock-heroes';
  9 +
  10 +// @Injectable()
  11 +// export class HeroService {
  12 +// getHeroes(): Hero[] {
  13 +// return HEROES;
  14 +// }
  15 +// }
  16 +
  17 +// Async services and Promises
  18 +@Injectable()
  19 +export class HeroService {
  20 +// getHeroes(): Promise<Hero[]> {
  21 +// return Promise.resolve(HEROES);
  22 +// }
  23 +
  24 +// getHeroesSlowly(): Promise<Hero[]> {
  25 +// return new Promise(resolve => {
  26 +// // Simulate server latency with 2 second delay
  27 +// setTimeout(() => resolve(this.getHeroes()), 2000);
  28 +// });
  29 +// }
  30 +
  31 +//HTTP service
  32 +// private heroesUrl = './mocks/in-memory-data.service'; // URL to web api
  33 +private heroesUrl = 'api/heroes'; // URL to web api
  34 + constructor(private http: Http) { }
  35 + getHeroes(): Promise<Hero[]> {
  36 + return this.http.get(this.heroesUrl)
  37 + .toPromise()
  38 + .then(response => response.json().data as Hero[])
  39 + .catch(this.handleError);
  40 + }
  41 + private handleError(error: any): Promise<any> {
  42 + console.error('An error occurred', error); // for demo purposes only
  43 + return Promise.reject(error.message || error);
  44 + }
  45 +}
  46 +
  1 +"use strict";
  2 +var InMemoryDataService = (function () {
  3 + function InMemoryDataService() {
  4 + }
  5 + InMemoryDataService.prototype.createDb = function () {
  6 + var heroes = [
  7 + { id: 11, name: 'Mr. Nice' },
  8 + { id: 12, name: 'Narco' },
  9 + { id: 13, name: 'Bombasto' },
  10 + { id: 14, name: 'Celeritas' },
  11 + { id: 15, name: 'Magneta' },
  12 + { id: 16, name: 'RubberMan' },
  13 + { id: 17, name: 'Dynama' },
  14 + { id: 18, name: 'Dr IQ' },
  15 + { id: 19, name: 'Magma' },
  16 + { id: 20, name: 'Tornado' }
  17 + ];
  18 + return { heroes: heroes };
  19 + };
  20 + return InMemoryDataService;
  21 +}());
  22 +exports.InMemoryDataService = InMemoryDataService;
  23 +//# sourceMappingURL=in-memory-data.service.js.map
  1 +{"version":3,"file":"in-memory-data.service.js","sourceRoot":"","sources":["in-memory-data.service.ts"],"names":[],"mappings":";AACA;IAAA;IAgBA,CAAC;IAfC,sCAAQ,GAAR;QACE,IAAI,MAAM,GAAG;YACX,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAC;YAC1B,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAC;YACvB,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAC;YAC1B,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAC;YAC3B,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAC;YACzB,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAC;YAC3B,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAC;YACxB,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAC;YACvB,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAC;YACvB,EAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAC;SAC1B,CAAC;QACF,MAAM,CAAC,EAAC,MAAM,QAAA,EAAC,CAAC;IAClB,CAAC;IACH,0BAAC;AAAD,CAAC,AAhBD,IAgBC;AAhBY,kDAAmB"}
  1 +import { InMemoryDbService } from 'angular-in-memory-web-api';
  2 +export class InMemoryDataService implements InMemoryDbService {
  3 + createDb() {
  4 + let heroes = [
  5 + {id: 11, name: 'Mr. Nice'},
  6 + {id: 12, name: 'Narco'},
  7 + {id: 13, name: 'Bombasto'},
  8 + {id: 14, name: 'Celeritas'},
  9 + {id: 15, name: 'Magneta'},
  10 + {id: 16, name: 'RubberMan'},
  11 + {id: 17, name: 'Dynama'},
  12 + {id: 18, name: 'Dr IQ'},
  13 + {id: 19, name: 'Magma'},
  14 + {id: 20, name: 'Tornado'}
  15 + ];
  16 + return {heroes};
  17 + }
  18 +}
  1 +"use strict";
  2 +exports.HEROES = [
  3 + { id: 11, name: 'Mr. Nicest' },
  4 + { id: 12, name: 'Narco' },
  5 + { id: 13, name: 'Bombasto' },
  6 + { id: 14, name: 'Celeritas' },
  7 + { id: 15, name: 'Magneta' },
  8 + { id: 16, name: 'RubberMan' },
  9 + { id: 17, name: 'Dynama' },
  10 + { id: 18, name: 'Dr IQ' },
  11 + { id: 19, name: 'Magma' },
  12 + { id: 20, name: 'Tornado' }
  13 +];
  14 +//# sourceMappingURL=mock-heroes.js.map
  1 +{"version":3,"file":"mock-heroes.js","sourceRoot":"","sources":["mock-heroes.ts"],"names":[],"mappings":";AAEa,QAAA,MAAM,GAAW;IAC5B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;IAC9B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1B,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;CAC5B,CAAC"}
  1 +import {Hero} from '../../models/hero'
  2 +
  3 +export const HEROES: Hero[] = [
  4 + { id: 11, name: 'Mr. Nicest' },
  5 + { id: 12, name: 'Narco' },
  6 + { id: 13, name: 'Bombasto' },
  7 + { id: 14, name: 'Celeritas' },
  8 + { id: 15, name: 'Magneta' },
  9 + { id: 16, name: 'RubberMan' },
  10 + { id: 17, name: 'Dynama' },
  11 + { id: 18, name: 'Dr IQ' },
  12 + { id: 19, name: 'Magma' },
  13 + { id: 20, name: 'Tornado' }
  14 +];
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <title>Angular QuickStart</title>
  5 + <base href="/">
  6 + <meta charset="UTF-8">
  7 + <meta name="viewport" content="width=device-width, initial-scale=1">
  8 + <link rel="stylesheet" href="styles.css">
  9 +
  10 + <!-- Polyfill(s) for older browsers -->
  11 + <script src="node_modules/core-js/client/shim.min.js"></script>
  12 +
  13 + <script src="node_modules/zone.js/dist/zone.js"></script>
  14 + <script src="node_modules/systemjs/dist/system.src.js"></script>
  15 +
  16 + <script src="systemjs.config.js"></script>
  17 + <script>
  18 + System.import('main.js').catch(function(err){ console.error(err); });
  19 + </script>
  20 + </head>
  21 +
  22 + <body>
  23 + <my-app>Loading AppComponent content here ...</my-app>
  24 + </body>
  25 +</html>
  1 +"use strict";
  2 +var platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
  3 +var app_module_1 = require("./app/app.module");
  4 +platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_module_1.AppModule);
  5 +//# sourceMappingURL=main.js.map
  1 +{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";AAAA,8EAA2E;AAE3E,+CAA6C;AAE7C,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC"}
  1 +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
  2 +
  3 +import { AppModule } from './app/app.module';
  4 +
  5 +platformBrowserDynamic().bootstrapModule(AppModule);
  1 +h1 {
  2 + color: #369;
  3 + font-family: Arial, Helvetica, sans-serif;
  4 + font-size: 250%;
  5 +}
  1 +var templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*)/gm;
  2 +var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
  3 +var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;
  4 +
  5 +module.exports.translate = function(load){
  6 + var url = document.createElement('a');
  7 + url.href = load.address;
  8 +
  9 + var basePathParts = url.pathname.split('/');
  10 +
  11 + basePathParts.pop();
  12 + var basePath = basePathParts.join('/');
  13 +
  14 + var baseHref = document.createElement('a');
  15 + baseHref.href = this.baseURL;
  16 + baseHref = baseHref.pathname;
  17 +
  18 + basePath = basePath.replace(baseHref, '');
  19 +
  20 + load.source = load.source
  21 + .replace(templateUrlRegex, function(match, quote, url){
  22 + let resolvedUrl = url;
  23 +
  24 + if (url.startsWith('.')) {
  25 + resolvedUrl = basePath + url.substr(1);
  26 + }
  27 +
  28 + return 'templateUrl: "' + resolvedUrl + '"';
  29 + })
  30 + .replace(stylesRegex, function(match, relativeUrls) {
  31 + var urls = [];
  32 +
  33 + while ((match = stringRegex.exec(relativeUrls)) !== null) {
  34 + if (match[2].startsWith('.')) {
  35 + urls.push('"' + basePath + match[2].substr(1) + '"');
  36 + } else {
  37 + urls.push('"' + match[2] + '"');
  38 + }
  39 + }
  40 +
  41 + return "styleUrls: [" + urls.join(', ') + "]";
  42 + });
  43 +
  44 + return load;
  45 +};
  1 +/**
  2 + * Add barrels and stuff
  3 + * Adjust as necessary for your application needs.
  4 + */
  5 +// (function (global) {
  6 +// System.config({
  7 +// packages: {
  8 +// // add packages here
  9 +// }
  10 +// });
  11 +// })(this);
  1 +/**
  2 + * System configuration for Angular samples
  3 + * Adjust as necessary for your application needs.
  4 + */
  5 +(function (global) {
  6 + System.config({
  7 + paths: {
  8 + // paths serve as alias
  9 + 'npm:': 'node_modules/'
  10 + },
  11 + // map tells the System loader where to look for things
  12 + map: {
  13 + // our app is within the app folder
  14 + 'app': 'app',
  15 +
  16 + // angular bundles
  17 + '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
  18 + '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
  19 + '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
  20 + '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
  21 + '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
  22 + '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
  23 + '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
  24 + '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
  25 +
  26 + // other libraries
  27 + 'rxjs': 'npm:rxjs',
  28 + 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
  29 + },
  30 + // packages tells the System loader how to load when no filename and/or no extension
  31 + packages: {
  32 + app: {
  33 + defaultExtension: 'js',
  34 + meta: {
  35 + './*.js': {
  36 + loader: 'systemjs-angular-loader.js'
  37 + }
  38 + }
  39 + },
  40 + rxjs: {
  41 + defaultExtension: 'js'
  42 + }
  43 + }
  44 + });
  45 +})(this);
  1 +{
  2 + "compilerOptions": {
  3 + "target": "es5",
  4 + "module": "commonjs",
  5 + "moduleResolution": "node",
  6 + "sourceMap": true,
  7 + "emitDecoratorMetadata": true,
  8 + "experimentalDecorators": true,
  9 + "lib": [ "es2015", "dom" ],
  10 + "noImplicitAny": true,
  11 + "suppressImplicitAnyIndexErrors": true
  12 + }
  13 +}
  1 +{
  2 + "rules": {
  3 + "class-name": true,
  4 + "comment-format": [
  5 + true,
  6 + "check-space"
  7 + ],
  8 + "curly": true,
  9 + "eofline": true,
  10 + "forin": true,
  11 + "indent": [
  12 + true,
  13 + "spaces"
  14 + ],
  15 + "label-position": true,
  16 + "label-undefined": true,
  17 + "max-line-length": [
  18 + true,
  19 + 140
  20 + ],
  21 + "member-access": false,
  22 + "member-ordering": [
  23 + true,
  24 + "static-before-instance",
  25 + "variables-before-functions"
  26 + ],
  27 + "no-arg": true,
  28 + "no-bitwise": true,
  29 + "no-console": [
  30 + true,
  31 + "debug",
  32 + "info",
  33 + "time",
  34 + "timeEnd",
  35 + "trace"
  36 + ],
  37 + "no-construct": true,
  38 + "no-debugger": true,
  39 + "no-duplicate-key": true,
  40 + "no-duplicate-variable": true,
  41 + "no-empty": false,
  42 + "no-eval": true,
  43 + "no-inferrable-types": true,
  44 + "no-shadowed-variable": true,
  45 + "no-string-literal": false,
  46 + "no-switch-case-fall-through": true,
  47 + "no-trailing-whitespace": true,
  48 + "no-unused-expression": true,
  49 + "no-unused-variable": true,
  50 + "no-unreachable": true,
  51 + "no-use-before-declare": true,
  52 + "no-var-keyword": true,
  53 + "object-literal-sort-keys": false,
  54 + "one-line": [
  55 + true,
  56 + "check-open-brace",
  57 + "check-catch",
  58 + "check-else",
  59 + "check-whitespace"
  60 + ],
  61 + "quotemark": [
  62 + true,
  63 + "single"
  64 + ],
  65 + "radix": true,
  66 + "semicolon": [
  67 + "always"
  68 + ],
  69 + "triple-equals": [
  70 + true,
  71 + "allow-null-check"
  72 + ],
  73 + "typedef-whitespace": [
  74 + true,
  75 + {
  76 + "call-signature": "nospace",
  77 + "index-signature": "nospace",
  78 + "parameter": "nospace",
  79 + "property-declaration": "nospace",
  80 + "variable-declaration": "nospace"
  81 + }
  82 + ],
  83 + "variable-name": false,
  84 + "whitespace": [
  85 + true,
  86 + "check-branch",
  87 + "check-decl",
  88 + "check-operator",
  89 + "check-separator",
  90 + "check-type"
  91 + ]
  92 + }
  93 +}