How to use AngularJS filter method with multiple check-boxes and regular input field? - angularjs

I am new to AngularJS. I have a grid where I display all the list of customers with 5 different check boxes.
Such as FirstName, LastName, checkboxes are for Ribs/Chicken/Brisket etc.
I would like to use the AngularJS filter method.
Currently, I have the following search.FirstName, search.LastName
In the ng-repeat = customer in customers | filter: search
The question I have is that
How can I use the filter method with checkboxes?
Please help me out how to solve this problem.
Thanks in advance.

Related

category keyword filter vuejs

Hey guys I have a fiddle that shows the code for my app I am trying to filter each video based on what category or keyword is clicked. I have it pretty well working except when I keep getting duplicates. For example my milkyway video is associated to the holiday, sports and misc categories so instead of just showing one milkyway when these categories are clicked I get three.
I have a data property that called filteredTemplateArray it looks like this.
filteredTemplateArray:Array[1]
0:Object
categoryArray:Array[3]
0:"Misc"
1:"Holiday"
2:"Sports"
dateAdded:"2018-10-01 17:54:22"
id:"233"
itemId:"fb41a01641bb2e769db412d3b21c2e3e"
itemName:"test"
keywordArray:Array[2]
0:"Snow"
1:"LensFlare"
projectPath:"M:/Projects/Generics/uploads/testLocation"
renderTime:"4"
stillImageLocation:"0.13"
tested:"0"
thumbName:"TEST"
when there objects with the same id in them I would like to filter out the duplicates. heres a link to my fiddle thanks https://jsfiddle.net/rshba6jz/

How to better personalize angular-bootstrap-calendar?

I'm trying to use angular-bootstrap-calendar and create a calendar where a user can select multiple dates in one go and add an event to the selected range. So far, following the documentation, I can create a custom template for a monthly cell or allow a user to select a range of dates. Unfortunately, as soon as I try to mix the two things I cannot select the range anymore but the custom template is working fine. I have created the calendar in this way
<mwl-calendar
view="calendarView"
view-date="viewDate"
events="prices"
view-title="calendarTitle"
on-event-click="eventClicked(calendarEvent)"
on-event-times-changed="calendarEvent.startsAt = calendarNewEventStart; calendarEvent.endsAt = calendarNewEventEnd"
custom-template-urls="{calendarMonthCell: 'customMonthCell.html'}"
on-date-range-select="rangeSelected(calendarRangeStartDate, calendarRangeEndDate)"
cell-is-open="true"
cell-modifier="cellModifier(calendarCell)">
</mwl-calendar>
Can anyone show me a plunker working example please?
Plunker to the example http://plnkr.co/edit/VHkbUEkrOcmnhiPOPbc4

How to create drop down with form in AngularJS

I am trying build drop down with form like this. I used ng-repeat inside li to build a simple dropdown and then placed them inside next to another. the number of columns can also can be dynamic so my approach wont work. How do I proceed to build such a dropdown. Is there any library out there that does this I could not find one.Thanks in advance.
If you want to do this with Angular, you will need to toggle a dropdown. The following example should be able to get you started: http://jsfiddle.net/Lvc0u55v/10630/
You will need to compose the columns and associate them with the ng-model.
On Operator field you can do the following:
<input ng-model="operator"/>
<li ng-repeat="result in results | filter:operator</li>

How to implement pagination in Angular when collection size is changing

I am trying to use angular-UI pagination for a table, where I am splicing the array where the page intersects the array. However I am not clear how to handle the fact that the array of objects is being added to and deleted to from within the table itself.
Also, I am sorting through a filter by the name property of an object in my ng-repeat. I expect what's is item[0] in my model array, does not correlate with the first item being displayed in the table via ng-repeat...I could be wrong.
I am just looking for advice on how to implement paging when the ng-repeat sorts the list, and the collection size is changing all the time.
Regards
I
you can try to use multiple filters at once for example:
ng-repeat="item in items | myFilter | limitTo:pageNumber*perPage | limitTo: -perPage"
This allow you to use your filter first on each collection/model change, then it show last "perPage" records dependig of "pageNumber".
Please see that demo : http://plnkr.co/edit/3nqRHUySsJZwpKQiMMTm?p=preview
just set watch to yourCollection.length
ie:
$scope.$watch('yourCollection.length', function(){
$scope.bigTotalItems = $scope.yourCollection.length;
}
)

Angular UI bootstrap: Type ahead select multiple

I am using angular UI bootstrap type-ahead directive for type-ahead in a form
http://angular-ui.github.io/bootstrap/
I am fetching the records from remote server via $http service. It is working fine.
However I can select only one element from list at a time.
I want to select multiple values from the list and show all currently selected element in input field with a remove button just like tags for SO. The selected tags are stored in angular array model.
How to achieve this ?
I have read documentation for Angular UI bootstrap but I am not able to find anything.
This guy made a directive for this. Should do exactly what you want and it's even using the ui-bootstraps typeahead.
https://github.com/mbenford/ngTagsInput
The best solution I have found so far is io.select
it does exactly what you require, multi-select typeahead.
and the markup is neat and clean too e.g:
<oi-select
oi-options="list.id as list.description for list in lists"
ng-model="tags"
multiple
placeholder="Select">
</oi-select>
This component is also compatible with bootstrap and the new bootstrap 4.
In js file :
To list all selected items, use $item with typeahead-on-select and push to an array for ex.evtMem. delete fn to delete selected item.
HTML :
Use table to list all array values using ng-repeat. Addition to that add remove glyphicon image and function to delete corresponding item.

Resources