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
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";
);
add a comment |
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";
);
what is the value ofthis.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 theshopidthat is passed from yourchangeevent ?
– CruelEngine
Jul 30 '18 at 6:45
@CruelEngine yes passed from my change event
– akhil murali
Jul 30 '18 at 6:49
add a comment |
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";
);
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";
);
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 ofthis.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 theshopidthat is passed from yourchangeevent ?
– CruelEngine
Jul 30 '18 at 6:45
@CruelEngine yes passed from my change event
– akhil murali
Jul 30 '18 at 6:49
add a comment |
what is the value ofthis.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 theshopidthat is passed from yourchangeevent ?
– 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
add a comment |
1 Answer
1
active
oldest
votes
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";
);
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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";
);
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
add a comment |
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";
);
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
add a comment |
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";
);
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";
);
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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
shopidthat is passed from yourchangeevent ?– CruelEngine
Jul 30 '18 at 6:45
@CruelEngine yes passed from my change event
– akhil murali
Jul 30 '18 at 6:49