Selected item in dropdown didn't show in Angular 2/42019 Community Moderator Electionangular 2/4 multiple drop downAngular HTML bindingHow to assign selected value to “Select” when value is of class object in angular 2Angular 4 - unable to set default value of dropdownPersist selected month in all dropdown toggle div's angular 4How to select default drop-down option based on falsy value in Angular?Angular - how to show dropdown selected value in textboxHow to set angular (Select all ) in side the dropdownangular 2/4 multiple drop downAngular 2/4 Onselect not gettingAngular - Reactive Form selct inpout box- Dropdown options issue

Can the damage from a Talisman of Pure Good (or Ultimate Evil) be non-lethal?

Old race car problem/puzzle

An Accountant Seeks the Help of a Mathematician

How to deal with taxi scam when on vacation?

Could the Saturn V actually have launched astronauts around Venus?

Rejected in 4th interview round citing insufficient years of experience

Why do Australian milk farmers need to protest supermarkets' milk price?

Schematic conventions for different supply rails

Did CPM support custom hardware using device drivers?

Science-fiction short story where space navy wanted hospital ships and settlers had guns mounted everywhere

Be in awe of my brilliance!

Why is "das Weib" grammatically neuter?

Bash: What does "masking return values" mean?

How could a scammer know the apps on my phone / iTunes account?

2D counterpart of std::array in C++17

Russian cases: A few examples, I'm really confused

Pinhole Camera with Instant Film

How to deal with a cynical class?

Meaning of "SEVERA INDEOVI VAS" from 3rd Century slab

How to simplify this time periods definition interface?

Bash replace string at multiple places in a file from command line

Using "wallow" verb with object

Welcoming 2019 Pi day: How to draw the letter π?

What does it mean to make a bootable LiveUSB?



Selected item in dropdown didn't show in Angular 2/4



2019 Community Moderator Electionangular 2/4 multiple drop downAngular HTML bindingHow to assign selected value to “Select” when value is of class object in angular 2Angular 4 - unable to set default value of dropdownPersist selected month in all dropdown toggle div's angular 4How to select default drop-down option based on falsy value in Angular?Angular - how to show dropdown selected value in textboxHow to set angular (Select all ) in side the dropdownangular 2/4 multiple drop downAngular 2/4 Onselect not gettingAngular - Reactive Form selct inpout box- Dropdown options issue










2















I am trying to develop a dropdown in my Angular application. The Drop Down is shop list. When I select a shop it will show or (display) the content in the shop. But when I change the drop down, the drop down will change but the content of the drop-down does not change, it will show the first selected content value(do not change the content) so Here I want selected item value to show or display.



HTML code



<span> 
<select class="formcontrol" name="outletDetail"(change)="onSelect($event.target.value)">
<option value="0" disabled>Select a Shop</option>
<option *ngFor="let outletDetail of outletDetails" value=outletDetail.ShopID>outletDetail.ShopName</option>
</select>
</span>


ts files



ngOnInit() 
this.Service.FetchPopulate().subscribe(outletsData => this.outletDetails = outletsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);


onSelect(shopid: number)
this.Service.FetchItemDetails(this.shopid, this.pageIndex).subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);










share|improve this question
























  • what is the value of this.shopid ?

    – CruelEngine
    Jul 30 '18 at 6:38











  • @CruelEngine its getting from DB

    – akhil murali
    Jul 30 '18 at 6:39











  • how are you using the shopid that is passed from your change event ?

    – CruelEngine
    Jul 30 '18 at 6:45











  • @CruelEngine yes passed from my change event

    – akhil murali
    Jul 30 '18 at 6:49
















2















I am trying to develop a dropdown in my Angular application. The Drop Down is shop list. When I select a shop it will show or (display) the content in the shop. But when I change the drop down, the drop down will change but the content of the drop-down does not change, it will show the first selected content value(do not change the content) so Here I want selected item value to show or display.



HTML code



<span> 
<select class="formcontrol" name="outletDetail"(change)="onSelect($event.target.value)">
<option value="0" disabled>Select a Shop</option>
<option *ngFor="let outletDetail of outletDetails" value=outletDetail.ShopID>outletDetail.ShopName</option>
</select>
</span>


ts files



ngOnInit() 
this.Service.FetchPopulate().subscribe(outletsData => this.outletDetails = outletsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);


onSelect(shopid: number)
this.Service.FetchItemDetails(this.shopid, this.pageIndex).subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);










share|improve this question
























  • what is the value of this.shopid ?

    – CruelEngine
    Jul 30 '18 at 6:38











  • @CruelEngine its getting from DB

    – akhil murali
    Jul 30 '18 at 6:39











  • how are you using the shopid that is passed from your change event ?

    – CruelEngine
    Jul 30 '18 at 6:45











  • @CruelEngine yes passed from my change event

    – akhil murali
    Jul 30 '18 at 6:49














2












2








2


1






I am trying to develop a dropdown in my Angular application. The Drop Down is shop list. When I select a shop it will show or (display) the content in the shop. But when I change the drop down, the drop down will change but the content of the drop-down does not change, it will show the first selected content value(do not change the content) so Here I want selected item value to show or display.



HTML code



<span> 
<select class="formcontrol" name="outletDetail"(change)="onSelect($event.target.value)">
<option value="0" disabled>Select a Shop</option>
<option *ngFor="let outletDetail of outletDetails" value=outletDetail.ShopID>outletDetail.ShopName</option>
</select>
</span>


ts files



ngOnInit() 
this.Service.FetchPopulate().subscribe(outletsData => this.outletDetails = outletsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);


onSelect(shopid: number)
this.Service.FetchItemDetails(this.shopid, this.pageIndex).subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);










share|improve this question
















I am trying to develop a dropdown in my Angular application. The Drop Down is shop list. When I select a shop it will show or (display) the content in the shop. But when I change the drop down, the drop down will change but the content of the drop-down does not change, it will show the first selected content value(do not change the content) so Here I want selected item value to show or display.



HTML code



<span> 
<select class="formcontrol" name="outletDetail"(change)="onSelect($event.target.value)">
<option value="0" disabled>Select a Shop</option>
<option *ngFor="let outletDetail of outletDetails" value=outletDetail.ShopID>outletDetail.ShopName</option>
</select>
</span>


ts files



ngOnInit() 
this.Service.FetchPopulate().subscribe(outletsData => this.outletDetails = outletsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);


onSelect(shopid: number)
this.Service.FetchItemDetails(this.shopid, this.pageIndex).subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);







angular angular2-template angular2-forms angular2-select






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 12:15









Roy

3,01121131




3,01121131










asked Jul 30 '18 at 6:35









akhil muraliakhil murali

15314




15314












  • what is the value of this.shopid ?

    – CruelEngine
    Jul 30 '18 at 6:38











  • @CruelEngine its getting from DB

    – akhil murali
    Jul 30 '18 at 6:39











  • how are you using the shopid that is passed from your change event ?

    – CruelEngine
    Jul 30 '18 at 6:45











  • @CruelEngine yes passed from my change event

    – akhil murali
    Jul 30 '18 at 6:49


















  • what is the value of this.shopid ?

    – CruelEngine
    Jul 30 '18 at 6:38











  • @CruelEngine its getting from DB

    – akhil murali
    Jul 30 '18 at 6:39











  • how are you using the shopid that is passed from your change event ?

    – CruelEngine
    Jul 30 '18 at 6:45











  • @CruelEngine yes passed from my change event

    – akhil murali
    Jul 30 '18 at 6:49

















what is the value of this.shopid ?

– CruelEngine
Jul 30 '18 at 6:38





what is the value of this.shopid ?

– CruelEngine
Jul 30 '18 at 6:38













@CruelEngine its getting from DB

– akhil murali
Jul 30 '18 at 6:39





@CruelEngine its getting from DB

– akhil murali
Jul 30 '18 at 6:39













how are you using the shopid that is passed from your change event ?

– CruelEngine
Jul 30 '18 at 6:45





how are you using the shopid that is passed from your change event ?

– CruelEngine
Jul 30 '18 at 6:45













@CruelEngine yes passed from my change event

– akhil murali
Jul 30 '18 at 6:49






@CruelEngine yes passed from my change event

– akhil murali
Jul 30 '18 at 6:49













1 Answer
1






active

oldest

votes


















1














Update this.shopid to shopid in API call and verify are you getting data or not.



onSelect(shopid: number) 
this.Service.FetchItemDetails(shopid, this.pageIndex) // change here
.subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);






share|improve this answer























  • Thanks for your answer but i got an error

    – akhil murali
    Aug 2 '18 at 11:31












  • @akhil what's error are you getting?

    – Rahul Sharma
    Aug 2 '18 at 12:18











  • can you please check this? this is the problem.stackoverflow.com/questions/51630451/…

    – akhil murali
    Aug 3 '18 at 3:14










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51588232%2fselected-item-in-dropdown-didnt-show-in-angular-2-4%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Update this.shopid to shopid in API call and verify are you getting data or not.



onSelect(shopid: number) 
this.Service.FetchItemDetails(shopid, this.pageIndex) // change here
.subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);






share|improve this answer























  • Thanks for your answer but i got an error

    – akhil murali
    Aug 2 '18 at 11:31












  • @akhil what's error are you getting?

    – Rahul Sharma
    Aug 2 '18 at 12:18











  • can you please check this? this is the problem.stackoverflow.com/questions/51630451/…

    – akhil murali
    Aug 3 '18 at 3:14















1














Update this.shopid to shopid in API call and verify are you getting data or not.



onSelect(shopid: number) 
this.Service.FetchItemDetails(shopid, this.pageIndex) // change here
.subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);






share|improve this answer























  • Thanks for your answer but i got an error

    – akhil murali
    Aug 2 '18 at 11:31












  • @akhil what's error are you getting?

    – Rahul Sharma
    Aug 2 '18 at 12:18











  • can you please check this? this is the problem.stackoverflow.com/questions/51630451/…

    – akhil murali
    Aug 3 '18 at 3:14













1












1








1







Update this.shopid to shopid in API call and verify are you getting data or not.



onSelect(shopid: number) 
this.Service.FetchItemDetails(shopid, this.pageIndex) // change here
.subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);






share|improve this answer













Update this.shopid to shopid in API call and verify are you getting data or not.



onSelect(shopid: number) 
this.Service.FetchItemDetails(shopid, this.pageIndex) // change here
.subscribe(itemsData => this.itemdetails = itemsData,
error =>
console.error(error);
this.statusMessage = "Problem with the service.Please try again after sometime";
);







share|improve this answer












share|improve this answer



share|improve this answer










answered Jul 30 '18 at 7:19









Rahul SharmaRahul Sharma

3,1341319




3,1341319












  • Thanks for your answer but i got an error

    – akhil murali
    Aug 2 '18 at 11:31












  • @akhil what's error are you getting?

    – Rahul Sharma
    Aug 2 '18 at 12:18











  • can you please check this? this is the problem.stackoverflow.com/questions/51630451/…

    – akhil murali
    Aug 3 '18 at 3:14

















  • Thanks for your answer but i got an error

    – akhil murali
    Aug 2 '18 at 11:31












  • @akhil what's error are you getting?

    – Rahul Sharma
    Aug 2 '18 at 12:18











  • can you please check this? this is the problem.stackoverflow.com/questions/51630451/…

    – akhil murali
    Aug 3 '18 at 3:14
















Thanks for your answer but i got an error

– akhil murali
Aug 2 '18 at 11:31






Thanks for your answer but i got an error

– akhil murali
Aug 2 '18 at 11:31














@akhil what's error are you getting?

– Rahul Sharma
Aug 2 '18 at 12:18





@akhil what's error are you getting?

– Rahul Sharma
Aug 2 '18 at 12:18













can you please check this? this is the problem.stackoverflow.com/questions/51630451/…

– akhil murali
Aug 3 '18 at 3:14





can you please check this? this is the problem.stackoverflow.com/questions/51630451/…

– akhil murali
Aug 3 '18 at 3:14



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51588232%2fselected-item-in-dropdown-didnt-show-in-angular-2-4%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229