bonsoir,

J'ai les codes suivantes:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 ngOnInit() {
 
  	this.article = new Article();
  	this.getRandomArticles();
 
  }
  getRandomArticles(): void {
    this.articleservice.getRandomArticles()
    .subscribe(article => {
    	console.log(article);
     this.article = article;
 });
Et dans le fichier html j'ai:


Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<div class="container">
 <table class="table table-striped">
  <thead>
  <th>Code</th>
  <th>Libelle</th>
  <th>Prix</th>
  <th>Description</th>
  </thead>
 
  <tbody>
 	 <tr >
 		<td>{{article.code}}</td>
 		<td>{{article.libelle}}</td>
  		<td>{{article.prix}}</td>
  		<td>{{article.description}}</td>
  	</tr>
 
  </tbody>
 
 </table>
 
 </div>


J'ai cette image:

Nom : Sans titre4.png
Affichages : 1420
Taille : 11,3 Ko


Quand je charge ma page, l'article dans le tableau change mais je veux que l'article dans le tableau change sans que je ne charge la page, comment puis je faire?
Merci