Filter aliasing doesn't work with collection-repeat.
What behavior are you expecting?
That it works, like when using ng-repeat ;)
Steps to reproduce:
Create a collection repeat list
Add a filter
as soon as you try to add an alias as filteredCollection it breaks
collection-repeat="customer in customers | filter:myFilter as filteredCollection"
Other information:
Somebody hacked the collection-repeat to make it work, but would be nicer if it could be official supported by ionic, so we don't lose the hacked feature when updating the ionic see forum post.
// 1. extend repeat expression to also match as
var match = repeatExpr.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
// 2. Optional: test if aliasExpr is valid
var aliasExpr = match[3];
if (aliasExpr && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasExpr) || /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasExpr))) {
throw Error("alias " + aliasExpr +" is invalid --- must be a valid JS identifier which is not a reserved name.");
// 3. make the alias available in the scope right under "collection-repeat expected an array for"
if (aliasExpr) {
scope[aliasExpr] = newValue;
}
Which Ionic Version? 1.x or 2.x
1.x latest
Run ionic info from terminal/cmd prompt: (paste output below)
Cordova CLI: 6.0.0
Ionic Version: 1.2.4
Ionic CLI Version: 2.0.0-beta.17
Ionic App Lib Version: 2.0.0-beta.8
ios-deploy version: 1.8.5
ios-sim version: 5.0.6
OS: Mac OS X El Capitan
Node Version: v5.3.0
Xcode version: Xcode 7.3 Build version 7D175
From @mnewmedia on March 29, 2016 11:9
Short description of the problem:
Filter aliasing doesn't work with collection-repeat.
What behavior are you expecting?
That it works, like when using ng-repeat ;)
Steps to reproduce:
as filteredCollection
it breaksOther information: Somebody hacked the collection-repeat to make it work, but would be nicer if it could be official supported by ionic, so we don't lose the hacked feature when updating the ionic see forum post.
Which Ionic Version? 1.x or 2.x 1.x latest
Run
ionic info
from terminal/cmd prompt: (paste output below) Cordova CLI: 6.0.0 Ionic Version: 1.2.4 Ionic CLI Version: 2.0.0-beta.17 Ionic App Lib Version: 2.0.0-beta.8 ios-deploy version: 1.8.5 ios-sim version: 5.0.6 OS: Mac OS X El Capitan Node Version: v5.3.0 Xcode version: Xcode 7.3 Build version 7D175Copied from original issue: driftyco/ionic#5979