javascript - what is the proper ng2 implementation sequence for refreshing component display based on dropdown selection? -
what proper ng2 implementation sequence refreshing component display based on dropdown selection? have users.component , users.service searches (posts) users based on provided request object.
the users component html template has region dropdown. when site user selects region dropdown, list of users belonging selected region should displayed in component based on selected region.
what proper way pass request object users.service? users.service should not build request object, of course, accept it. in traditional js, bind click event of dropdown call refreshdisplay() function gets selected value, builds request object , makes ajax call request object.
in traditional js, bind click event of dropdown call refreshdisplay() function gets selected value, builds request object , makes ajax call request object.
that's you'll in angular, except instead of directly interacting browser event, you'll use angular's abstraction:
<select (change)="somemethod()"> ...options </select>
Comments
Post a Comment