Quantcast
Channel: Arrow operator VS passing the argument in function: what is the difference? - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Arrow operator VS passing the argument in function: what is the difference?

$
0
0

//component.ts
What is the difference in putting i as arrow operator or putting i within a function.

this.service.getuser().subscribe(i => {    this.myuserList = i;});

// As shown below, the below code the data data is not painted in html page

this.service.getUserList().subscribe(function(i : any){    this.myuserList = i;});

// Also putting the html code for reference

//component.html <tr *ngFor = 'let p of myuserList'><td>{{p.username}}</td><td>{{p.address.suite}}</td></tr>

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images