Skip to content

Commit 1b2f2d3

Browse files
Vlado TesanovicVlado Tesanovic
Vlado Tesanovic
authored and
Vlado Tesanovic
committed
Angular rc.1
1 parent c5b50e1 commit 1b2f2d3

40 files changed

+7521
-43195
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
node_modules
2-
public/assets/js/app
32
.idea
43
typings
54
server/**/*.js
65
server/**/*.js.map
7-
npm-debug.log
6+
client/**/*.js
7+
client/**/*.js.map

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Vlado Tesanovic
3+
Copyright (c) 2016 Vlado Tesanovic
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

client/components/app.component.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Component, Type } from "@angular/core";
2+
import { ROUTER_DIRECTIVES, Routes, Router } from '@angular/router';
3+
import { HomeComponent } from "./home/home.component";
4+
5+
@Component({
6+
directives: [ROUTER_DIRECTIVES],
7+
selector: "app",
8+
template: `
9+
<div class="center">
10+
<img src='https://angular.io/resources/images/logos/standard/shield-large.png'>
11+
</div>
12+
<router-outlet></router-outlet>`
13+
})
14+
@Routes([
15+
{ component: <Type>HomeComponent, path: "/home" }
16+
])
17+
export class AppComponent {
18+
constructor(private router: Router) {}
19+
20+
ngOnInit() {
21+
this.router.navigate(['/home']);
22+
}
23+
}

client/components/home.ts renamed to client/components/home/home.component.ts

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import { Component } from "angular2/core";
2-
import { SEMANTIC_COMPONENTS, SEMANTIC_DIRECTIVES } from "ng-semantic";
3-
import { Http, Headers, RequestOptions } from "angular2/http";
1+
import { Component } from "@angular/core";
2+
// import { SEMANTIC_COMPONENTS, SEMANTIC_DIRECTIVES } from "ng-semantic";
3+
import { Http, Headers, RequestOptions } from "@angular/http";
44
import 'rxjs/add/operator/map'
5-
import { config } from "../config";
65

76
@Component({
8-
directives: [SEMANTIC_COMPONENTS, SEMANTIC_DIRECTIVES],
7+
directives: [/* SEMANTIC_COMPONENTS, SEMANTIC_DIRECTIVES */],
98
selector: "home",
10-
templateUrl: config.templateUrl + `components/home.html`
9+
templateUrl: `client/components/home/home.component.html`
1110
})
1211
export class HomeComponent {
1312
response: any;
@@ -35,8 +34,8 @@ export class HomeComponent {
3534
}
3635
call() {
3736

38-
delete this.error;
39-
delete this.data;
37+
this.error = undefined;
38+
this.data = undefined;
4039

4140
this.http.get("/api", new RequestOptions({
4241
headers: new Headers({"Auth": localStorage.getItem("jwt"), "Content-Type": "application/json"})
@@ -58,12 +57,12 @@ export class HomeComponent {
5857
.map((res: any) => res.json())
5958
.subscribe(
6059
(res: any) => {
61-
delete this.error;
60+
this.error = undefined;
6261
this.data = {
6362
text: "You can call protected api now",
6463
title: "Login succesfull"
6564
};
66-
65+
6766
localStorage.setItem("jwt", res.jwt);
6867
},
6968
(error: any) => {
@@ -73,7 +72,7 @@ export class HomeComponent {
7372
}
7473
remove() {
7574
this.error = { message: "JWT removed" };
76-
delete this.data;
75+
this.data = undefined;
7776
localStorage.removeItem("jwt");
7877
}
7978
}

client/config.ts

-3
This file was deleted.

client/main.ts

+8-22
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
/// <reference path="../typings/browser.d.ts" />
2-
import { Component, provide } from "angular2/core";
3-
import { HTTP_PROVIDERS } from "angular2/http";
4-
import { bootstrap } from "angular2/platform/browser";
5-
import { ROUTER_PROVIDERS, RouterOutlet, LocationStrategy, RouteConfig, HashLocationStrategy } from "angular2/router";
2+
import { bootstrap } from '@angular/platform-browser-dynamic';
3+
import { provide, Type } from "@angular/core";
4+
import { HashLocationStrategy, LocationStrategy } from "@angular/common";
5+
import { HTTP_PROVIDERS } from "@angular/http";
6+
import { ROUTER_PROVIDERS } from '@angular/router';
67

7-
import { HomeComponent } from "./components/home";
8+
import { AppComponent } from "./components/app.component";
89

9-
@Component({
10-
directives: [RouterOutlet],
11-
selector: "app",
12-
template: `
13-
<div class="center">
14-
<img src='https://angular.io/resources/images/logos/standard/shield-large.png'>
15-
</div>
16-
<router-outlet></router-outlet>`
17-
})
18-
@RouteConfig([
19-
{ component: HomeComponent, path: "/" }
20-
])
21-
22-
class AppComponent { }
23-
24-
bootstrap(AppComponent, [
10+
bootstrap(<Type>AppComponent, [
2511
ROUTER_PROVIDERS,
2612
HTTP_PROVIDERS,
27-
provide(LocationStrategy, { useClass: HashLocationStrategy })
13+
provide(LocationStrategy, {useClass: <Type>HashLocationStrategy})
2814
]);

client/tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"module": "system",
55
"moduleResolution": "node",
66
"sourceRoot": "./client",
7-
"outDir": "../public/assets/js/app",
87
"sourceMap": true,
98
"emitDecoratorMetadata": true,
109
"experimentalDecorators": true,

copy.js

-29
This file was deleted.

package.json

+21-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"private": true,
77
"scripts": {
88
"develop": "concurrently \"tsc -w -p ./server\" \"tsc -w -p ./client\" \"nodemon ./server/bin/www\" ",
9-
"typings": "typings install"
9+
"typings": "typings install",
10+
"bundle": "node tools/builder.js",
11+
"bundle:prod": "node tools/builder.js --prod"
1012
},
1113
"engines": {
1214
"node": ">= 5.4.1 < 6"
@@ -23,19 +25,28 @@
2325
"serve-favicon": "~2.3.0"
2426
},
2527
"devDependencies": {
26-
"angular2": "^2.0.0-beta.15",
28+
"@angular/common": "2.0.0-rc.1",
29+
"@angular/compiler": "2.0.0-rc.1",
30+
"@angular/core": "2.0.0-rc.1",
31+
"@angular/http": "2.0.0-rc.1",
32+
"@angular/platform-browser": "2.0.0-rc.1",
33+
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
34+
"@angular/router": "2.0.0-rc.1",
35+
"@angular/router-deprecated": "2.0.0-rc.1",
36+
"@angular/upgrade": "2.0.0-rc.1",
37+
"angular2-in-memory-web-api": "0.0.9",
2738
"angular2-jwt": "^0.1.9",
2839
"concurrently": "^2.0.0",
29-
"es6-promise": "^3.0.2",
30-
"es6-shim": "0.35.0",
40+
"core-js": "^2.4.0",
3141
"ng-semantic": "^1.0.21",
3242
"nodemon": "^1.9.1",
33-
"recursive-copy": "^2.0.3",
34-
"reflect-metadata": "0.1.2",
35-
"rxjs": "5.0.0-beta.2",
36-
"systemjs": "^0.19.26",
43+
"reflect-metadata": "^0.1.3",
44+
"rxjs": "5.0.0-beta.6",
45+
"systemjs": "0.19.27",
46+
"systemjs-builder": "^0.15.17",
3747
"typescript": "^1.8.10",
38-
"typings": "^0.7.12",
39-
"zone.js": "0.6.10"
48+
"typings": "^0.8.1",
49+
"yargs": "^4.7.1",
50+
"zone.js": "^0.6.12"
4051
}
4152
}

0 commit comments

Comments
 (0)