Get values from database in drop down [closed] - javascript

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
Here is my code:
<ui-select ng-model="apptDetails.profile" name="profile" theme="bootstrap" ng-required="true">
<ui-select-match placeholder="Select Profile" >{{$select.selected.Profile_name}}
</ui-select-match>
<ui-select-choices
repeat="profile.Profile_id as profile in profileList | filter: $select.search">
<span ng-bind-html="profile.Profile_name | highlight: $select.search" ></span>
</ui-select-choices>
</ui-select>
I need to get values from database and its already displayed in dropdown, I get values in ng-model but it cant be set in drop down (not in option) however if I send post request it works.
e.g: if profile is abc on database for particular user, it displays on that dropdown pre selected. When I get information for that user in form, all the text fields get data from model but it cant be shown in the dropdown.

You may have done something wrong... As i created a demo on plunker, its working fine.
May be it can help you...
https://plnkr.co/edit/43ToW4?p=preview

Try this for ng-repeat
<ui-select-choices
repeat="profile in profileList | filter:$select.search">
<span ng-bind-html="profile.Profile_name | highlight: $select.search" > </span>
</ui-select-choices>

Related

Unable to build a multi-level menu using mat menu [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am using Angular 8 with Angular Material to build a multi-level menu that is 3 levels deep.
E.g.
One -> Two -> Three
StackBlitz Example:
https://stackblitz.com/edit/dynamic-sidenav-multi-level-menu-u93fqt?file=app%2Fapp.component.html
Does anyone know how I can solve this? I want to stop the list of items from closing automatically, i.e. to display item Three.
Remove the mat-list-item Element from the submenus and place matMenuTriggerFor on the button with the mat-menu-item decorator instead:
<mat-menu #menu1="matMenu">
<button mat-menu-item [matMenuTriggerFor]="menu2">Two</button>
</mat-menu>
Your full example:
https://dynamic-sidenav-multi-level-menu-cnarmb.stackblitz.io

Point Per Total Price System [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
im trying to build something almost like a cashier system with php jquery and html
so im confuse about the point system
i got a simple input here :The input form
so the user will input their total price and base on that they'll get point ,
so for example user will get 1 poin every $10 , so when the user input $15 he's got 1 poin , and when the user input $13, he's still got 1 point, but when user input $20, he's gonna get 2 point , so thats basically thats how the system work, and my question is how to achieve that kind of system with php
you can use:
$points = floor($price/10);

Autohint user input as he enters text [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
What I'm struggling to find a way to achieve is a way to auto complete the input itself while users type.
As an image worth more than a thousand words I'm basically looking to replicate the same behaviour that you can experience in the city search input of Airbnb
Image to see the input in action
Does anyone have an idea of how I can make an input that have a similar behaviour ?
PS : I'm not looking for a code implementation, just hints about how do you think this can be achieved
I think what you are looking at is called as typeahead. You can use Twitter's typeahead. There are plethora of tutorials, documentation and code snippets available for typeahaed implementation. Here is an example of twitter's typeahead.

How to show non-popular checkboxes on button click in angular? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
In a form I've got a list of about 15 checkboxes, of which 3 are the most popular. So by default I only want to show the 3 popular choices. At the end of the 3 checkboxes there should be an icon to expand and collapse the rest of the checkboxes.
I'm building the website in Angular, so I guess I can simply use an ng-show for this. The thing is that I wonder whether that is the correct way to do this. It seems to me that this is such a common thing, that there should be some kind of standard way of doing this..?
And also what kind of icon do people normally use for this? For expand and collapse I would normally use the little grey triangle, but I feel it doesn't suit this specific situation well. I know I've seen this before in other forms, but I just can't find it anymore to take inspiration from.
All tips are welcome!
I use ng-show for a similar purpose in my application and it works well. I set the default value in my controller and then make the ng-click event trigger a toggle.
Controller:
$scope.expanded = false;
Html:
<div ng-show="!expanded">
<span class="glyphicon glyphicon-triangle-bottom" title="Expand" ng-click="expanded=true">
</div>
<div ng-show="expanded">
<span class="glyphicon glyphicon-triangle-top" title="Collapse" ng-click="expanded=false">
</div>
As for icons, I like to use bootstrap glyphicons. The glyphicon glyphicon-triangle-top and glyphicon glyphicon-triangle-bottom are good for collapse/expand, as well as glyphicon glyphicon-plus-sign and glyphicon glyphicon-minus-sign. You can find more here.

Get number with javascript [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a Javascript Bookmarlet, in which I want to grab a price that might be displayed on the current page.
So for example on shopping sites it could grab the price of an item the user is currently looking at.
I figured one way would be to grab all the text on the page, perhaps with something like get web page text via javascript
And then from there filter to get just the number after a currency symbol is found (£,$ etc) which should in theory leave just the Price.
However I am now sure how I would go about actually filtering to just the number, and if this is at all the right way to go about this?
How about get the text value of mark up?
E.g. Say you had:
<span id="price">£5.00</span>
You could do the following with jQuery:
$('#price').text();
Or vanilla javascript:
document.getElementById('price').innerText
Provided there is infact a wrapper around the text or you have access to the markup.

Categories

Resources