Skip to content
This repository was archived by the owner on Aug 18, 2018. It is now read-only.

Commit 6124be0

Browse files
committed
migrating to typescript 2.4
1 parent 30703cb commit 6124be0

11 files changed

Lines changed: 68 additions & 55 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"ts-loader": "^2.0.0",
8282
"tslint": "^4.4.2",
8383
"tslint-loader": "^3.4.2",
84-
"typescript": "^2.1.0",
84+
"typescript": "^2.4.0",
8585
"webpack": "^2.2.1",
8686
"webpack-fail-plugin": "^1.0.5"
8787
},

src/demo/authors/author.component.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as angular from 'angular';
22
import 'angular-ui-router';
33
import * as Jsonapi from '../../library/index';
44

5-
class AuthorController {
5+
class AuthorController implements ng.IController {
66
public author: Jsonapi.IResource;
77
public relatedbooks: Jsonapi.IResource[];
88

@@ -31,6 +31,10 @@ class AuthorController {
3131
);
3232
}
3333

34+
public $onInit() {
35+
36+
}
37+
3438
/**
3539
Add a new author
3640
**/
@@ -64,14 +68,7 @@ class AuthorController {
6468
}
6569
}
6670

67-
export const Author = {
68-
templateUrl: 'demo/authors/author.html',
69-
controller: AuthorController
70-
// bindings: {
71-
// completedCount: '<',
72-
// activeCount: '<',
73-
// selectedFilter: '<filter',
74-
// onClearCompleted: '&',
75-
// onShow: '&'
76-
// }
71+
export class Author {
72+
templateUrl = 'demo/authors/author.html';
73+
controller = AuthorController;
7774
};

src/demo/authors/authors.component.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Jsonapi from '../../library/index';
22

3-
class AuthorsController {
3+
class AuthorsController implements ng.IController {
44
public authors: Jsonapi.ICollection;
55

66
/** @ngInject */
@@ -19,6 +19,10 @@ class AuthorsController {
1919
);
2020
}
2121

22+
public $onInit() {
23+
24+
}
25+
2226
public delete (author: Jsonapi.IResource) {
2327
console.log('eliminaremos (no soportado en este ejemplo)', author.toObject());
2428
this.AuthorsService.delete(
@@ -30,14 +34,7 @@ class AuthorsController {
3034
}
3135
}
3236

33-
export const Authors = {
34-
templateUrl: 'demo/authors/authors.html',
35-
controller: AuthorsController
36-
// bindings: {
37-
// completedCount: '<',
38-
// activeCount: '<',
39-
// selectedFilter: '<filter',
40-
// onClearCompleted: '&',
41-
// onShow: '&'
42-
// }
37+
export class Authors {
38+
public templateUrl = 'demo/authors/authors.html';
39+
public controller = AuthorsController;
4340
};

src/demo/books/book.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Jsonapi from '../../library/index';
22

3-
export class BookController {
3+
export class BookController implements ng.IController {
44
public book: any = null;
55

66
/** @ngInject */
@@ -22,9 +22,13 @@ export class BookController {
2222
}
2323
);
2424
}
25+
26+
public $onInit() {
27+
28+
}
2529
}
2630

27-
export const Book = {
28-
templateUrl: 'demo/books/book.html',
29-
controller: BookController
31+
export class Book {
32+
public templateUrl = 'demo/books/book.html';
33+
public controller = BookController;
3034
};

src/demo/books/books.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Jsonapi from '../../library/index';
22

3-
class BooksController {
3+
class BooksController implements ng.IController {
44
public books: Jsonapi.ICollection;
55

66
/** @ngInject */
@@ -63,12 +63,16 @@ class BooksController {
6363
);
6464
}
6565

66+
public $onInit() {
67+
68+
}
69+
6670
public delete(book: Jsonapi.IResource) {
6771
this.BooksService.delete(book.id);
6872
}
6973
}
7074

71-
export const Books = {
72-
templateUrl: 'demo/books/books.html',
73-
controller: BooksController
75+
export class Books {
76+
public templateUrl = 'demo/books/books.html';
77+
public controller = BooksController;
7478
};

src/demo/containers/app.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export class AppController {
2-
1+
class AppController implements ng.IController {
32
/** @ngInject */
43
constructor(
54
protected JsonapiCore,
@@ -31,10 +30,14 @@ export class AppController {
3130
self.$scope.loading = 'No connection 2!!!';
3231
};
3332
}
33+
34+
public $onInit() {
35+
36+
}
3437
}
3538

36-
export const App = {
37-
templateUrl: 'demo/containers/app.html',
38-
controller: AppController,
39-
transclude: true
39+
export class App implements ng.IComponentOptions {
40+
public templateUrl: 'demo/containers/app.html';
41+
public controller: ng.Injectable<ng.IControllerConstructor> = AppController;
42+
public transclude: true;
4043
};

src/demo/index.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ angular
3333
.service('AuthorsService', AuthorsService)
3434
.service('BooksService', BooksService)
3535
.service('PhotosService', PhotosService)
36-
.component('app', App)
37-
.component('author', Author)
38-
.component('authors', Authors)
39-
.component('book', Book)
40-
.component('books', Books)
41-
.component('photos', Photos)
42-
.component('noduplicatedcalltests', NoDuplicatedHttpCalls)
36+
.component('app', new App())
37+
.component('author', new Author())
38+
.component('authors', new Authors())
39+
.component('book', new Book())
40+
.component('books', new Books())
41+
.component('photos', new Photos())
42+
.component('noduplicatedcalltests', new NoDuplicatedHttpCalls())
4343
;

src/demo/photos/photos.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Jsonapi from '../../library/index';
22

3-
class PhotosController {
3+
class PhotosController implements ng.IController {
44
public photos: Jsonapi.ICollection;
55

66
/** @ngInject */
@@ -15,6 +15,10 @@ class PhotosController {
1515
this.makeRequest(5);
1616
}
1717

18+
public $onInit() {
19+
20+
}
21+
1822
public makeRequest(id) {
1923
this.photos = this.PhotosService.all(
2024
succes => {
@@ -24,7 +28,7 @@ class PhotosController {
2428
}
2529
}
2630

27-
export const Photos = {
28-
templateUrl: 'demo/photos/photos.html',
29-
controller: PhotosController
31+
export class Photos {
32+
public templateUrl = 'demo/photos/photos.html';
33+
public controller = PhotosController;
3034
};

src/demo/tests/noduplicatedhttpcalls.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Jsonapi from '../../library/index';
22

3-
class NoDuplicatedHttpCallsComponent {
3+
class NoDuplicatedHttpCallsComponent implements ng.IController {
44
public authors: Array<Jsonapi.ICollection> = [];
55

66
/** @ngInject */
@@ -19,9 +19,13 @@ class NoDuplicatedHttpCallsComponent {
1919
);
2020
}
2121
}
22+
23+
public $onInit() {
24+
25+
}
2226
}
2327

24-
export const NoDuplicatedHttpCalls = {
25-
templateUrl: 'demo/tests/noduplicatedhttpcalls.html',
26-
controller: NoDuplicatedHttpCallsComponent
28+
export class NoDuplicatedHttpCalls {
29+
public templateUrl = 'demo/tests/noduplicatedhttpcalls.html';
30+
public controller = NoDuplicatedHttpCallsComponent;
2731
};

src/library/interfaces/cache.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ICollection, IResource } from '../interfaces';
1+
import { IResource } from '../interfaces';
22

33
export interface ICache {
44
setResource(resource: IResource): void;

0 commit comments

Comments
 (0)