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

Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page