Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Bodim.lk out now !
Manoj Suranga Bandara
Updated:
Sunday at 3:05 AM
Power Lifting Lever Belt
SkullVamp
Updated:
Jun 13, 2026
Ad icon
port.lk Domain for sale
Lankan-Tech
Updated:
Jun 13, 2026
Colombo
Kaduwela - Two Storey House for Sale
dilrasan
Updated:
Jun 11, 2026
Ad icon
Wechat qr verification
Pawan2005
Updated:
Jun 11, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
ElaKiri Programmer's Club
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="හෙනයා" data-source="post: 22949129" data-attributes="member: 510186"><p><span style="font-size: 12px"><p style="text-align: center">Angular කරන කට්ටියගෙන් පොඩි උපදෙසක් ඕනේ.. </p></span></p><p style="text-align: center"><span style="font-size: 12px"></p></span></p><p style="text-align: center"><span style="font-size: 12px">[PHP]1. getStudent(id: string): Student {</p></span></p><p style="text-align: center"><span style="font-size: 12px">2. let newStudent: Student;</p></span></p><p style="text-align: center"><span style="font-size: 12px">3. this.studentService.findOneById(id).subscribe(student => {</p></span></p><p style="text-align: center"><span style="font-size: 12px">4. student.links.forEach(link => {</p></span></p><p style="text-align: center"><span style="font-size: 12px">5. if (link.rel === 'laptop') {</p></span></p><p style="text-align: center"><span style="font-size: 12px">6. this.laptopService.findOneByUrl(link.href).subscribe(laptop => {</p></span></p><p style="text-align: center"><span style="font-size: 12px">7. student.laptop = laptop;</p></span></p><p style="text-align: center"><span style="font-size: 12px">8. });</p></span></p><p style="text-align: center"><span style="font-size: 12px">9. } else if (link.rel === 'batch') {</p></span></p><p style="text-align: center"><span style="font-size: 12px">10. this.batchService.findOneByUrl(link.href).subscribe(batch => {</p></span></p><p style="text-align: center"><span style="font-size: 12px">11. student.batch = batch;</p></span></p><p style="text-align: center"><span style="font-size: 12px">12. });</p></span></p><p style="text-align: center"><span style="font-size: 12px">13. } else if (link.rel === 'subject') {</p></span></p><p style="text-align: center"><span style="font-size: 12px">14. this.subjectService.findAllByUrl(link.href).subscribe(subjects => {</p></span></p><p style="text-align: center"><span style="font-size: 12px">15. student.subjects = subjects;</p></span></p><p style="text-align: center"><span style="font-size: 12px">16. });</p></span></p><p style="text-align: center"><span style="font-size: 12px">17. }</p></span></p><p style="text-align: center"><span style="font-size: 12px">18. });</p></span></p><p style="text-align: center"><span style="font-size: 12px">19. newStudent = student;</p></span></p><p style="text-align: center"><span style="font-size: 12px">20. });</p></span></p><p style="text-align: center"><span style="font-size: 12px">21. return newStudent;</p></span></p><p style="text-align: center"><span style="font-size: 12px">22. }</p></span></p><p style="text-align: center"><span style="font-size: 12px">[/PHP]</p></span></p><p style="text-align: center"><span style="font-size: 12px"></p></span></p><p style="text-align: center"><span style="font-size: 12px">මේ වගේ තැනකදී Observable එකකට subscribe වෙලා call back function එක ඇතුලේ ඕනේ දේ ලියන්නේ නැතුව යට line වල ලිව්වම callback එක complete වෙන්න කලින් යට line execute වෙනවනේ.. </p></span></p><p style="text-align: center"><span style="font-size: 12px">example එකක් විදිහට 19 වෙනි line එක execute වෙද්දී subscribe වෙලා ගන්න [PHP]laptop, batch, subjects[/PHP] objects student එකට assign වෙලා නෑ.. ඒ වගේම 21 වෙනි line එකේ return වෙන්නේ empty [PHP]newStudent[/PHP] object එකක්.. </p></span></p><p style="text-align: center"><span style="font-size: 12px">මේ වගේ තැන්වලදී කරන්න පුළුවන් දේවල් මොනාද? නැත්තම් callback ඇතුලේ callback ලියන්න වෙනවද?</p><p></span></p></blockquote><p></p>
[QUOTE="හෙනයා, post: 22949129, member: 510186"] [SIZE="3"][CENTER]Angular කරන කට්ටියගෙන් පොඩි උපදෙසක් ඕනේ.. [PHP]1. getStudent(id: string): Student { 2. let newStudent: Student; 3. this.studentService.findOneById(id).subscribe(student => { 4. student.links.forEach(link => { 5. if (link.rel === 'laptop') { 6. this.laptopService.findOneByUrl(link.href).subscribe(laptop => { 7. student.laptop = laptop; 8. }); 9. } else if (link.rel === 'batch') { 10. this.batchService.findOneByUrl(link.href).subscribe(batch => { 11. student.batch = batch; 12. }); 13. } else if (link.rel === 'subject') { 14. this.subjectService.findAllByUrl(link.href).subscribe(subjects => { 15. student.subjects = subjects; 16. }); 17. } 18. }); 19. newStudent = student; 20. }); 21. return newStudent; 22. } [/PHP] මේ වගේ තැනකදී Observable එකකට subscribe වෙලා call back function එක ඇතුලේ ඕනේ දේ ලියන්නේ නැතුව යට line වල ලිව්වම callback එක complete වෙන්න කලින් යට line execute වෙනවනේ.. example එකක් විදිහට 19 වෙනි line එක execute වෙද්දී subscribe වෙලා ගන්න [PHP]laptop, batch, subjects[/PHP] objects student එකට assign වෙලා නෑ.. ඒ වගේම 21 වෙනි line එකේ return වෙන්නේ empty [PHP]newStudent[/PHP] object එකක්.. මේ වගේ තැන්වලදී කරන්න පුළුවන් දේවල් මොනාද? නැත්තම් callback ඇතුලේ callback ලියන්න වෙනවද?[/CENTER][/SIZE] [/QUOTE]
Insert quotes…
Verification
Winadiyakata thappara keeyak tibeda?
Post reply
Top
Bottom