The md-select search filter currently functions according to the ng-value, but it is important for it to also

I am using a md select search filter with multiple options available.
For instance:
id: 133, label:'Route1'
id: 144, label:'Route2'
id: 155, label:'Route3'
id: 166, label:'Route4'

If I input '1' in the filter, only the first option should be displayed. However, all options are currently being shown because the id field contains '1'.

Here is a snippet of the code:

<md-select id="Route" name="Route" ng-model="filter.RouteIds" multiple data-md-container-class="mdSelect" md-on-close="RouteChange();" ng-required="(sellerFilter && needfilter && '@routeReq' =='required')">
    <md-select-header class="mdSelectHeader">
        <input ng-model="SearchRoute"
            type="search"
            placeholder="@Misc.getResource("APP_CMN_LBL_Search")"
            class="mdSelectSearchBox md-text">
    </md-select-header>
    <md-button style="width: 93%;text-align: left;font-size: 12px;" value="all" ng-click="fnSelectAllRoute()">{{routeToggleText}}</md-button>
    <md-option ng-repeat="route in routes | filter: SearchRoute" value="{{route.value}}" ng-mousemove="fnCheckToggleText(filter.RouteIds.length, routes.length, 'routeToggle');">
        {{route.label}}
    </md-option>
</md-select>

Answer №1

To find the specific object property, you must identify it by its label in this scenario.

filter: { name: SearchRoute}

The correct syntax should be

<md-option ng-repeat="route in routes | filter: { name: SearchRoute}" value="{{route.value}}" ng-mousemove="fnCheckToggleText(filter.RouteIds.length, routes.length, 'routeToggle');">
                                                        {{route.label}}

You can view a similar example on CodePen

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Verify whether a document retrieved from mongoDB contains a certain property

Dealing with user accounts in Mongoose, I have set it up so that the user can use their phone number to sign in: const account = await db.Account.findOne({ phone: req.body.phone }) : Now, I need to confirm if there is a property named verified in the acco ...

You cannot directly access an array useState by index in React js, but you can use the map function to

export interface JobListing { id: number, isTraded: boolean, feedback: string, title: string, message: string, skills: string[], sender: string, ipAddress: string } const GroupList = () => { const [jobListings, setJobListings] = useSt ...

Managing the clearing of a view component in React or Vue.js

In my project, I have a container component that handles all the business logic, ajax requests, and data management. This container component has child components to which it passes data and methods as props. For example, there is a "CommentForm" compone ...

Angular8 Chart.js customizes the Y axis tick labels

Is there a way to dynamically adjust the Y-axis ticks in a chart.js graph? I attempted to modify them using the following commands: this.chartOptions.scales.yAxes[0].ticks.min = 10; this.chartOptions.scales.yAxes[0].ticks.max = 18; ...

Encountering a "400 Bad Request" error when using Ajax within WordPress

I've been trying to submit a form using Ajax within a plugin. I had two plugins, the first one was initially working but has stopped now and I can't seem to find any errors. I don't think the issue lies in the code itself, but I'm feeli ...

Utilizing ThemeProvider in a Different Component in React

In my App.js file, I have a function that toggles between light and dark mode themes: import { createTheme, ThemeProvider } from '@mui/material/styles' import Button from '@mui/material/Button' import Header from './components/Head ...

Sending Data in Angular JS

Looking for guidance on Angular JS as a newcomer. I have set up a form on my index.html page, and when the user fills in the details and hits submit, I want it to redirect to a details.html page where all the filled-in information can be displayed. HTML ...

React ensures that the page is not rerendered until after data has been fetched

I am dealing with the following code snippet. This is my React hook: const [isLoading, setIsLoading] = React.useState(true); useEffect(() => { setIsLoading(() => true); // I expect the page to rerender and display loading now. const select ...

Customizing error messages in Joi validationorHow to show custom

Hi there, currently I am utilizing "@hapi/joi": "^15.1.1". Unfortunately, at this moment I am unable to upgrade to the most recent Joi version. This represents my validation schema const schema = { name: Joi.string() .all ...

What is the best way to add a dynamic parameter to the URL?

Here is an example of my URL: https://my-website.com/api/players?countryId=1&clubId=2&playerName=abc The parameter values can vary. This is the code snippet I use: getDataPlayer(payload) { let params if(payload.countryId && payl ...

Unveiling the magic of Vue Composition API: Leveraging props in the <script setup> tag

I'm currently working on creating a component that takes a title text and a tag as properties to display the title in the corresponding h1, h2, etc. tag. This is my first time using the sweet <script setup> method, but I've encountered a pr ...

What is the reason behind the non-reversible nature of atob and btoa

Looking for a simple way to obscure answers to quiz questions in Markdown temporarily? The idea is to reveal the answers during the presentation, no need for secure encryption. Considered using atob('message I want to obfuscate') and letting stu ...

Guide on submitting a form via Ajax on a mobile app

Looking for a way to submit the form located in components/com_users/views/login/tmpl/default_login.php using Ajax. <form action="<?php echo JRoute::_('index.php?option=com_users&task=user.login'); ?>" method="post"> <fie ...

Leveraging an AngularJS service within Angular framework

I am trying to incorporate an AngularJS service into my Angular project. Below is my main.ts file: import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {AppModule} from './app/app.module'; import {UpgradeMo ...

What is the process for making changes to Google Sheet information?

Encountering an issue when trying to update data in a Google sheet using Next.js. The error message ReferenceError: row is not defined keeps popping up and I can't figure out where I'm going wrong. Any help in resolving this error would be greatl ...

Combining React-Redux and Bootstrap: A sophisticated modal feature

Struggling with the distinction between components and containers when using Bootstrap's modal in React-Redux. Instead of repetitively creating modals, I aim to develop a React Component that encompasses a modal template. For clarification, here&apo ...

I designed a dropdown menu with a searchable <mat-select> feature, where selecting an item is automatic when a space bar is pressed in the search box

Description : I have implemented a dropdown list using element that contains a list of items along with a search field. This allows users to easily search for specific items in the list instead of manually scrolling through a long dropdown menu. They can ...

JavaScript code can be enhanced with HTML comments to improve readability

I have incorporated Google ad into my website using the following code. <script type="text/javascript"><!-- google_ad_client = "pub-"; /*Top 468x15 */ google_ad_slot = ""; google_ad_width = 468; google_ad_height = 15; //--> </script> < ...

Angular JavaScript Object Notation structure

I am a beginner in AngularJS and I'm attempting to create formatted JSON based on the values of table rows (tr) and cells (td). The table rows are generated automatically. When the form is submitted, I try to create the JSON values. Once the form is ...

Is it possible to track when a user switches to a different component in Angular?

I'm looking to set up a confirmation popup when the user attempts to navigate to a different page. I've come across information about hostListener and canActivate, but I'm not exactly sure how to begin! Any guidance would be greatly apprecia ...