ionic framework causing issues with custom filter for angularjs

The custom filter:searchFilter is functioning properly in regular HTML. Here's a demo: http://codepen.io/anon/pen/Oyydxa. However, the same function does not seem to work within the Ionic framework.

<input type="search" placeholder="Search" ng-model="filterName">
<ion-item class="item-remove-animate item-avatar item-icon-right" ng-repeat="leaf in leafs | filter:searchFilter" type="item-text-wrap" href="#/tab/leafs/{{leaf.id}}">

filter

$scope.searchFilter = function(obj) {
    var re = new RegExp($scope.filterName, 'i');
    return !$scope.filterName || re.test(obj.botanical_name) || re.test(obj.en_names) || re.test(obj.ml_names);
};

Check out the Ionic demo here: http://codepen.io/anon/pen/pjjGWo

Unfortunately, when I use console.log($scope.filterName), it appears empty. Any suggestions on how to resolve this issue?

Answer №1

To achieve better functionality, consider relocating the ng-controller="MyCtrl" attribute from the <div ng-app="ionicApp"> element to the <ion-content> tag like this:

<ion-content ng-controller="MyCtrl">

You can view an updated version 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

Troubleshooting Media Queries Problems in HTML and CSS

Check out the code snippet below: //Modifying text content (function() { var texts = $(".altered"); var textIndex = -1; function displayNextText() { ++textIndex; var t = texts.eq(textIndex) .fadeIn(2000) if (textIndex < te ...

PHP must be loaded before Javascript code will be executed

I am in the process of creating a high-tech "smart home" webpage, but I am facing an issue with the code execution order. Despite trying to use sleep() and other tactics, I can't seem to display the success message before running the script that reboo ...

Looking for assistance with updating a JavaScript Object Array and embedding it into a function

Below is the code snippet I am working with: $("#map4").gMap({ markers: [ { address: "Tettnang, Germany", html: "The place I live" }, { address: "Langenargen, German ...

Encountering a build error while using npm and node-gyp

When attempting to install client-session using npm, I encountered an error. I also tried to install node_gyp using npm, as well as cloning it using git, but the node gyp error persisted. Unfortunately, I could not locate proper documentation on the root ...

Seeking assistance with basic Javascript/Jquery for Ajax on Rails 3 - can anyone help?

I've been diving into JavaScript and hit a roadblock. At the moment, I have a very basic gallery/image application. My goal is to create a functionality where clicking on an image will lead the user to a URL stored in my model data using AJAX. Additi ...

Create a new feature in React JS that allows users to add a component to

I'm having trouble figuring out how to create a function that loads data (from a local json) into a li element, and then adds a new component to the clicked li upon click. Here's an example of what I'm trying to achieve: <ul> < ...

Discovering documents within a database by utilizing a query string

Currently, I am attempting to search for documents within my database by using a query string: app.get('/', (request, response) => { db.collection('mycollection').find(req.query).toArray((error, results) => { console.log(re ...

Upon selecting a hyperlink, the function's value ought to be saved within a text box

Some programming languages I'm working with are PHP, Javascript, and HTML I've created a PHP function that is stored in page2.php: function pot() { does something; returns a value; } In another page (page1.php), there is a link and a textbox: ...

The custom configuration file for SailsJS does not seem to be loading properly

After following the documentation and advice on StackOverflow, I attempted to load custom configuration for my application. However, I faced a failure. I went ahead and created a new file named /config/application.js In this file, I added the followi ...

Add up identical keys within an array containing multiple objects

I am working with an array of objects that look like this: [ { 'name': 'P1', 'value': 150 }, { 'name': 'P1', 'value': 150 }, { 'na ...

When you hover over a single div among a collection of similar ones, reveal the rest

Hey there! I have a bunch of products each with their own description. I'm trying to make the "tile-description" visible when hovering over a "middle tile", and also add a border around the "large-tile" on hover. I've included the markup and some ...

Preventing Error in D3 Updates Caused by Invalid Path Formats

I'm encountering a problem with the d3 tree layout while dynamically adding nodes. When I add a path symbol to the node based on its type, I receive an error message "invalid path format" during updates. Both the Enter and update methods utilize the ...

Creating a typesafe union type in TypeScript for a form function is a great way to

I am working on a function that can take either a single value or an array of values, and produce new values based on the input. However, the function is unable to determine whether to return a single value or an array based on the type of the input. How ...

Guide on transferring a file between folders using JavaScript

I am currently experiencing difficulties transferring images from one folder to another. Is it possible to accomplish this using JavaScript? Please advise me on how I can achieve this task. I already have the image path (e.g.: C:\Program Files\xa ...

Programmatically eliminate CSS style rules from an individual HTML element

I am looking to insert some HTML elements into my document that will not have any predefined style. It is crucial that these elements maintain a consistent appearance across different projects and webpages. These elements will be added dynamically to the p ...

Angular UI grid - Dynamic translation of grid data

I am working with angular ui-grid and I need to dynamically translate the grid. For example, if the current language is English, I want the grid to be displayed in English. However, if I switch to French, I want all menu options to be translated to French. ...

StopPropagation() method in Ng-class not functioning properly in Angular for parent element

I am facing an issue with 2 nested ng-repeats. The parent one is supposed to add a class based on ng-click, but even when I click the child, it still triggers when I don't want it to. <div class="add-filter-tags" data-filter="{{f1}}" ng-class="{&a ...

Running a Neo4j Cypher query with the help of jQuery

I've been attempting to create an Ajax call using jQuery to a Neo4j Server, both residing on the same machine. However, I keep encountering errors in the response. This is how my ajax call is written: var request = $.ajax({ type: "POST", url ...

Leveraging NextJS to perform server side rendering by injecting parameters from a caller component

I'm currently in the process of creating an application with a storefront using nextJS. I've successfully utilized getServerSideProps when loading a new page. This particular page is quite complex, as it consists of multiple components, each req ...

Can JavaScript's Gamepad API be used to register a custom game controller?

Background Story Working on a virtual reality app with A-frame to showcase VR gadgets. Custom controllers connect via websocket/bluetooth and we want them compatible with tracked-controls. These components use Gamepad API for model positioning and are fri ...