From d1bd21d4ebc39ed5eed5be4ba325d4509b06ceb1 Mon Sep 17 00:00:00 2001 From: Xiwen Cheng Date: Thu, 20 Aug 2015 08:49:38 +0200 Subject: [PATCH 1/3] Remove tsconfig.json because webpack won't build with it Solves: https://github.com/auth0/angular2-authentication-sample/issues/32 --- tsconfig.json | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 tsconfig.json diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index bbe0232..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "1.5.0", - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "declaration": false, - "noImplicitAny": false, - "removeComments": true, - "noLib": false, - "emitDecoratorMetadata": true, - "sourceMap": true, - "listFiles": true, - "outDir": "dist" - }, - "files": [ - "node_modules/typescript/bin/dom.d.ts", - "src/custom_typings/ng2.d.ts", - "typings/tsd.d.ts", - "src/components/app.ts", - "src/bootstrap.ts" - ] -} From 5e38d5a4cd4b1f6238220b97f4815682e077bc9d Mon Sep 17 00:00:00 2001 From: Xiwen Cheng Date: Thu, 20 Aug 2015 08:52:16 +0200 Subject: [PATCH 2/3] Inject Router everywhere to fix runtime issues Solves: Cannot resolve all parameters for Home(?). Make sure they all have valid type --- src/app/app.ts | 4 ++-- src/home/home.ts | 8 +++++--- src/login/login.ts | 9 ++++++--- src/signup/signup.ts | 10 +++++++--- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/app/app.ts b/src/app/app.ts index f28ea01..66d5f51 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,6 +1,6 @@ /// -import {View, Component} from 'angular2/angular2'; +import {View, Component, Inject} from 'angular2/angular2'; import {Location, RouteConfig, RouterLink, Router} from 'angular2/router'; import {LoggedInRouterOutlet} from './LoggedInOutlet'; import {Home} from '../home/home'; @@ -24,6 +24,6 @@ let template = require('./app.html'); { path: '/signup', as: 'signup', component: Signup } ]) export class App { - constructor(public router: Router) { + constructor(@Inject(Router) router: Router) { } } diff --git a/src/home/home.ts b/src/home/home.ts index a10ffea..fac0689 100644 --- a/src/home/home.ts +++ b/src/home/home.ts @@ -1,9 +1,9 @@ /// -import {Component, View} from 'angular2/angular2'; +import {Component, View, Inject} from 'angular2/angular2'; import {coreDirectives} from 'angular2/directives'; import {status, text} from '../utils/fetch' -import { Router} from 'angular2/router'; +import {Router} from 'angular2/router'; let styles = require('./home.css'); let template = require('./home.html'); @@ -22,8 +22,10 @@ export class Home { decodedJwt: string; response: string; api: string; + router: Router; - constructor(public router: Router) { + constructor(@Inject(Router) router: Router) { + this.router = router; this.jwt = localStorage.getItem('jwt'); this.decodedJwt = this.jwt && window.jwt_decode(this.jwt); } diff --git a/src/login/login.ts b/src/login/login.ts index 9bfd200..c24dd4c 100644 --- a/src/login/login.ts +++ b/src/login/login.ts @@ -1,8 +1,8 @@ /// -import {Component, View} from 'angular2/angular2'; +import {Component, View, Inject} from 'angular2/angular2'; import {status, json} from '../utils/fetch' -import { Router, RouterLink } from 'angular2/router'; +import {Router, RouterLink } from 'angular2/router'; let styles = require('./login.css'); @@ -18,7 +18,10 @@ let template = require('./login.html'); directives: [RouterLink] }) export class Login { - constructor(public router: Router) { + router: Router; + + constructor(@Inject(Router) router: Router) { + this.router = router; } login(event, username, password) { diff --git a/src/signup/signup.ts b/src/signup/signup.ts index a4f0f27..4f2b408 100644 --- a/src/signup/signup.ts +++ b/src/signup/signup.ts @@ -1,9 +1,9 @@ /// import {coreDirectives} from 'angular2/directives'; -import {Component, View} from 'angular2/angular2'; +import {Component, View, Inject} from 'angular2/angular2'; import {status, json} from '../utils/fetch'; -import { Router, RouterLink } from 'angular2/router'; +import {Router, RouterLink } from 'angular2/router'; let styles = require('./signup.css'); let template = require('./signup.html'); @@ -16,8 +16,12 @@ let template = require('./signup.html'); styles: [ styles ], template: template }) + export class Signup { - constructor(public router: Router) { + router: Router; + + constructor(@Inject(Router) router: Router) { + this.router = router; } signup(event, username, password) { From 1b3f2067c6d95ef7b3ad1bb376c42ecfc84ad09f Mon Sep 17 00:00:00 2001 From: Xiwen Cheng Date: Thu, 20 Aug 2015 08:57:03 +0200 Subject: [PATCH 3/3] Correct npm start command in readme to reflect package.json --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index b5726fd..81393f4 100644 --- a/Readme.md +++ b/Readme.md @@ -14,5 +14,5 @@ Clone this repository as well as [the server](https://github.com/auth0/nodejs-jw First, run the server app in the port `3001`. -Then, run `npm install` on this project and run `npm startwatch` to start the app. Then just navigate to [http://localhost:3000](http://localhost:3000) :boom: +Then, run `npm install` on this project and run `npm start` to start the app. Then just navigate to [http://localhost:3000](http://localhost:3000) :boom: