Created
January 30, 2024 18:07
-
-
Save Kamilnaja/78fc932b3de2adaace353d0b6129ab18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Struktura klasy | |
@ViewChild, @ViewChildren, ContentChild | |
@Inputy @Outputy | |
readonly observable$, subject | |
pola publiczne | |
pola prywatne | |
constructor() | |
gettery | |
ngOnInit | |
ngAfterViewInit i inne metody lifecycle | |
metody publiczne | |
metody prywatne | |
ngOnDestroy | |
Przykład | |
export class AppComponent implements OnInit, AfterViewInit, OnDestroy { | |
@ViewChild('sidenav') sidenav: any; | |
readonly isloading$ = new BehaviorSubject<boolean>(false); | |
userName = 'Ktoś tam'; | |
private tajnePole = 42; | |
title = 'Diet Tracker'; | |
constructor(private metaTagService: Meta, private titleService: Title) {} | |
get titleGetter() { | |
return this.title; | |
} | |
ngOnInit(): void { | |
this.metaTagService.addTags([ | |
{ | |
name: 'keywords', | |
content: 'Angular SEO Integration, foods, diary, lifestyle', | |
}, | |
{ name: 'robots', content: 'index' }, | |
{ name: 'author', content: 'Tomasz Sokalski' }, | |
{ name: 'viewport', content: 'width=device-width, initial-scale=1' }, | |
{ name: 'date', content: '2023-03-08', scheme: 'YYYY-MM-DD' }, | |
{ charset: 'UTF-8' }, | |
]); | |
this.titleService.setTitle('Diet Tracker'); | |
} | |
ngAfterViewInit(): void { | |
throw new Error('Method not implemented.'); | |
} | |
btnClicked() { | |
console.log('user has clicked btn'); | |
} | |
private logDate() { | |
console.log('date'); | |
} | |
ngOnDestroy(): void { | |
console.log('bye'); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment