Reputation: 1936
I have written a custom filter to change the output of ng-repeat. We have a list of files in JSON and I am creating the links to assets from the filter, as the json builds them with just the filename and not the actual path.
Filter:
filter('readLink', [function(){
return function(text) {
var myURI = [],
newLink;
text.split('/').forEach(function(uriItem) {
myURI.push(uriItem);
});
newLink = myURI[3] + '/' + myURI[4] + '/' + myURI[5] + '/' + myURI[6];
return newLink;
}
}])
HTML Binding:
<ul class="sob-repeat">
<li ng-repeat="sobitem in sobUT">
<h4>{{sobitem.title}}</h4>
{{sobitem.date}} - <a ng-href="{{sobitem.audio | audioFix}}">Listen</a> - <a ng-href="#/read/{{sobitem.transcript | readLink}}">Read</a>
</li>
</ul>
In IE8 is comes up while in REAL BROWSERS it works as expected. :)
Upvotes: 0
Views: 1226
Reputation: 76
I had the same problem recently. change to angular.forEach
didn't solve the problem. Instead, regular for loop
solved the problem
Upvotes: 0
Reputation: 9457
array.forEach
is not supported on IE 8, did you remember to polyfill it for IE 8? Or alternatively, use angular.forEach
.
Upvotes: 1