Skip to content

Commit 405e223

Browse files
committed
Add anotation to app
1 parent 1d77d16 commit 405e223

File tree

6 files changed

+28
-41
lines changed

6 files changed

+28
-41
lines changed

src/app/about/about.component.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
77
about works!
88
</text>
99
`,
10-
styles: [],
1110
encapsulation: ViewEncapsulation.None
1211
})
13-
export class AboutComponent implements OnInit {
14-
constructor() {}
15-
16-
ngOnInit() {}
17-
}
12+
export class AboutComponent {}

src/app/app.component.html

+1-16
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<app-hello [name]="name"></app-hello>
66

77
<text>Github username</text>
8-
<linedit [text]="name" [placeholderText]="'Insert github username'" (textChanged)="textChanged($event)"></linedit>
8+
<linedit [text]="name" [placeholderText]="'Insert github username'" (textChanged)="onTextChanged($event)"></linedit>
99

1010
<button (clicked)="goToPage('/')">
1111
first page
@@ -16,22 +16,7 @@
1616
<button (clicked)="goToPage('/about')">
1717
about page
1818
</button>
19-
<!-- <checkbox [checked]="true"></checkbox>
20-
<checkbox [checked]="true" [enabled]="false"></checkbox>
2119

22-
<button [style.background-color]="'green'" (clicked)="setName()">
23-
Green button
24-
</button>
25-
26-
<progressbar [value]="40" [minimum]="0" [maximum]="100"></progressbar>
27-
<spinbox
28-
[prefix]="'aa'"
29-
[suffix]="'bb'"
30-
[singleStep]="10"
31-
[range]="{ minimum: 0, maximum: 50 }"
32-
[value]="20"
33-
>
34-
</spinbox> -->
3520
<router-outlet></router-outlet>
3621
</view>
3722
</window>

src/app/app.component.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { AspectRatioMode } from '@nodegui/nodegui';
99
import { Router } from '@angular/router';
1010
import { NgWindow } from '../../projects/angular-nodegui/src/lib/components/window';
1111

12+
const windowHeight = 480;
13+
const windowWeight = 620;
14+
1215
@Component({
1316
selector: 'app-root',
1417
templateUrl: './app.component.html',
@@ -23,18 +26,27 @@ export class AppComponent implements OnInit {
2326

2427
constructor(private router: Router) {}
2528

26-
ngOnInit() {
29+
/**
30+
* Init component and configure window widget
31+
*/
32+
ngOnInit(): void {
2733
const win = this.window.nativeElement.parent;
2834

29-
win.resize(480, 620);
30-
win.setMinimumSize(480, 620);
35+
win.resize(windowHeight, windowWeight);
36+
win.setMinimumSize(windowHeight, windowWeight);
3137
}
3238

33-
goToPage(url: string) {
39+
/**
40+
* Change router
41+
*/
42+
public goToPage(url: string): void {
3443
this.router.navigateByUrl(url);
3544
}
3645

37-
textChanged(val: string) {
46+
/**
47+
* Change text from text edit
48+
*/
49+
public onTextChanged(val: string): void {
3850
this.name = val;
3951
}
4052
}

src/app/github.service.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { from } from 'rxjs';
3-
import { HttpClient } from '@angular/common/http';
2+
import { from, Observable } from 'rxjs';
43
import fetch from 'node-fetch';
54

65
const API_URL = 'https://api.github.com';
@@ -9,7 +8,10 @@ const API_URL = 'https://api.github.com';
98
providedIn: 'root'
109
})
1110
export class GithubService {
12-
getUser(username: string) {
11+
/**
12+
* Get user profile
13+
*/
14+
getUser(username: string): Observable<any> {
1315
return from(fetch(`${API_URL}/users/${username}`).then(res => res.json()));
1416
}
1517
}

src/app/hello/hello.component.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
Component,
3-
OnInit,
43
ViewEncapsulation,
54
Input,
65
OnDestroy
@@ -14,7 +13,8 @@ import { Subscription } from 'rxjs';
1413
styleUrls: ['./hello.component.scss'],
1514
encapsulation: ViewEncapsulation.None
1615
})
17-
export class HelloComponent implements OnInit, OnDestroy {
16+
export class HelloComponent implements OnDestroy {
17+
1818
@Input() set name(value) {
1919
this.getUsername(value);
2020
}
@@ -25,9 +25,7 @@ export class HelloComponent implements OnInit, OnDestroy {
2525

2626
constructor(private github: GithubService) {}
2727

28-
ngOnInit(): void {}
29-
30-
private getUsername(username: string) {
28+
private getUsername(username: string): void {
3129
if (this.subscribtion) {
3230
this.subscribtion.unsubscribe();
3331
}

src/app/home/home.component.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core';
77
home works!
88
</text>
99
`,
10-
styles: [],
1110
encapsulation: ViewEncapsulation.None
1211
})
13-
export class HomeComponent implements OnInit {
14-
constructor() {}
15-
16-
ngOnInit() {}
17-
}
12+
export class HomeComponent {}

0 commit comments

Comments
 (0)