SHARE
TWEET

Untitled

a guest Aug 19th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <button (click)="appendDataToLink()">
  2.  
  3. test = [
  4.    { name: 'karthik', id: 1, link: '/abc/def/ghi' },
  5.    { name: 'shahbaz', id: 2, link: '/jkl/mno/pqr'}
  6. ]
  7.      
  8. generateRandomNumber() {
  9.    return Math.floor(Math.random() * 10);
  10. }
  11. appendDataToLink() {
  12.   this.test.forEach( e => {
  13.      e.link = `${e.link}/rd-${this.generateRandomNumber()}`
  14.   });
  15.   console.log(this.test);
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top