Is there a way to create a filter in AngularJS that targets a specific nested property?

Here is a sample of the data I am working with:

{"createDate":"2014-04-22T08:14:10.285Z",
 "desc":"Hello hello",
 "gradeFrom":"4",
 "gradeTo":"7",
 "owner":"example@example.com",
 "schoolType":{
     "name":"Primary School"
  },
 "subject":{ 
     "En":false,
     "Ge":false,
     "Re":true,
     "Sh":false,
     "SvA":false,
     "Tn":false
  },
 "title":"Testing testing"}

My goal is to filter the data so that when a user clicks a button and sets $scope.searchText to "Re":true, only the data entries where "subject": {"Re":true} are displayed.

I am currently using filtering with a search string, however, it only filters through the top layer properties like "createDate", "desc", and not the nested "subject" property.

<tr ng-repeat="lesson in lessons | orderByPriority | filter:searchText | orderBy:'createDate':true">

Answer №1

All you need to do is fill in the

$scope.searchText.subject.RE = true
field, and let the filter take care of the rest.

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

Tips for resolving the warning message: "Utilize a callback function in the setState method to reference the

I'm having an issue with this code fragment as ESLint is giving me a warning: "Use callback in setState when referencing the previous state react/no-access-state-in-setstate". Can someone help me resolve this? const updatedSketch = await ImageManipula ...

Using JavaScript to access the PHP web service that returns a JSON response

I am a beginner in PhoneGap and I'm looking to create my own android application using PhoneGap. I have attempted it multiple times but have not been successful. Does anyone have knowledge on how to "Access Web Service of PHP in JavaScript that will ...

"Exploring the process of integrating a controller into an external HTML file using AngularJS

I'm relatively new to AngularJS. In my web app, I have a set of buttons: index.html <button class="aButton">a</button> <button class="bButton">b</button> <script> $(document).ready(function(){ $(".aButton"). ...

Using jQuery to access the value of the CSS property "margin-left"

I created a JavaScript game with moving divs that have different transition times. The game includes a function that is called every 1/100 seconds, which checks the position of the divs using: $("class1").css("margin-left") Here's the strange part: ...

The Google Geo Charts fail to load when initiated by Ajax requests

My goal is to use ajax to load an external HTML page that includes the following code: <script type='text/javascript' src='https://www.google.com/jsapi'></script> <script type='text/javascript'> function ...

Bootstrap modal for interactive table rows

I'm working with a 3-rowed table and I want to be able to click on each row and display more information about the content in a modal pop-up. However, when I attempt to click on a row, the screen darkens but the pop-up does not appear. <!DOCTYPE h ...

Best Practices for Sequencing Vuex Actions and Safely Updating the State in between Calls

I have a Vuex store set up in my application with defined getters, actions, and mutations. One of the actions, called initConfiguration, is responsible for fetching data from an API and then committing this data to a mutation that updates the state. This a ...

The September/October 2013 release of the Ajax Control Toolkit is causing conflicts with jQuery

After updating our project to utilize the latest October 2013 release of the Ajax Control Toolkit for the HTML editor extender and Ajax file uploader, we encountered unexpected issues. Our ASP.NET 4.0 project, which previously used C#, jQuery 1.9.0, jQuery ...

How can I retrieve an array of dates for the current month using jQuery?

Is there a way to create an array of dates in YYYY-MM-DD format for the current month using jQuery? For instance, if the current month is August, I am looking to have an array that looks similar to this: [2018-08-01, 2018-08-02, --------- 2018-08-31] ...

Adjust the color of the paper in Material-UI

I'm in the process of creating a React project using the material-ui library. Currently, I am facing an issue with customizing the drawer component's background color. After some research, I learned that modifying the paper attribute of the drawe ...

A guide to monitoring and managing errors in the react-admin dataProvider

Rollbar has been successfully integrated into my react-admin app to track uncaught errors. However, I've noticed that errors thrown by the dataProvider are not being sent to Rollbar. It seems like errors from the dataProvider are internally handled w ...

AngularJS request has exceeded the time limit

Although this question may have been asked before, I couldn't find a solution. It's currently 10:30pm and I really need help from you guys! The issue I'm facing involves two json server methods - one to update data and the other to get new ...

Problem with Jquery slider user interface

Encountering an issue with the min and max values of the jQuery Slider UI. Set the minimum value to 5000, maximum to 1000000, with step increments of 25000. However, when viewing it on the front-end, the displayed values are not as expected: https://i.sst ...

Is there a way to stop the dropdown from automatically appearing in a DropDownList?

Seeking a solution to use a custom table as the dropdown portion for a DropDownList in my project. My goal is for users to see the custom table when they click on the DropDownList, rather than the default dropdown menu. I expected to be able to achieve th ...

Jquery issue: Lightbox unexpectedly closing by itself :(

Help needed: My light box is closing automatically within seconds. $(document).ready(function(){ $('.lightbox').click(function(){ $('.backdrop, .box').animate({'opacity':'.50'}, 300, 'linear'); ...

Discover the secrets of accessing two distinct objects returned by a single REST URL with Backbone

I am working with a REST URL that looks like this: /users/<user_id>/entities This URL returns data containing 2 objects as follows: { "players": { "test_player2": { "_id": "test_player2", "user": "f07590 ...

Difficulty aligning Material2 icons and title text in CSS styling

I'm encountering a design problem when incorporating material2 icons into my Angular application. Specifically, I have a button that displays both a material2 icon and some text side by side from left to right. Currently, the icons are centered within ...

What is the best way to extract text from a string that is enclosed by two particular words?

Using Ajax, I am extracting the complete HTML code from JSON. Once fetched, the string appears as follows : <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="Content-Type" cont ...

What is the best way to execute multiple node.js scripts from a primary node.js script?

Embarking on my node.js journey for the first time, I find myself with two scripts that need to be executed. Rather than running them separately, I am looking to combine them into a single node.js script. Can anyone provide insights or guidance on how to ...

Is this accessible within a function?

When attempting to pass a reference to a class through to a method in order to access a variable, I encountered a few issues: My initial attempt looked like this: p.id = 1; p._initEvents = function(){ $('#file-form').on('valid.fndtn.ab ...