Last active
October 16, 2019 08:59
-
-
Save nhamilakis/978289c0b16008029d7555e0305f11ba to your computer and use it in GitHub Desktop.
Get Stuff in Angular
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
class Corpus { | |
name: string; | |
} | |
@TrucAngularAUZEF | |
class MyCorporaComponent extends OnInit { | |
listCorpora : Array<Corpus> = []; | |
constructor(private api: MyAPIServiceDeLEspace){} | |
ngOninit(){ | |
// se truc se lance a chaque l'initiation du component | |
this.api.getCorpus(1).subscribe( | |
(data) => this.listCorpora = data, | |
(err) => console.log('fuck there was error : ${err}'), | |
); | |
} | |
} |
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
@injectStuff | |
class MyAPIServiceDeLEspace { | |
constructor(http: NGHTT){} | |
getCorpus(id: string){ | |
return this.http.get('http://api/corpus/' + id ) | |
} | |
} |
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
<div *ngFor="corpora of listCorpora"> | |
<span> {{ corpora.name }} </span> | |
</div> |
Author
nhamilakis
commented
Oct 16, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment