Issue with Angular Filter - in ver 1.4

52 views
Skip to first unread message

Hassan Faghihi

unread,
Jul 1, 2015, 3:04:46 AM7/1/15
to ang...@googlegroups.com
dear folks, 

i receive infinite digest error  (infdig) in following code, i wrongly post it on github, any way i reference you there:

https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#-got-a-question-or-problem

some guys says you have injection issue, but i tried several variable, all of them where empty, or maybe i wrongly inject them,
also i tried to name my filter and then say:

...
function myFilterName = {...};
myFilterName
.$stateful = true;
return myFilterName
...


but it didnt worked too

Hassan Faghihi

unread,
Jul 1, 2015, 5:57:51 AM7/1/15
to ang...@googlegroups.com

Hassan Faghihi

unread,
Jul 3, 2015, 12:57:30 PM7/3/15
to ang...@googlegroups.com

Any thing?!

On Jul 1, 2015 2:28 PM, "Hassan Faghihi" <mimosh.p...@gmail.com> wrote:

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/x6jDY6FypNE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Hassan Faghihi

unread,
Jul 4, 2015, 1:57:21 AM7/4/15
to ang...@googlegroups.com
so no one can help with this filter?

//angular.module("sbrpr.filters", [])

            app.filter('gapedGroupBy', function () {
                var results = {};
                return function (data, key) { //Data => My Objects Array - Key => Name Of Filtered Property
                    if (!(data && key)) return;
                    var result;
                    if (!this.$id) {
                        result = {};
                    } else {
                        var scopeId = this.$id;
                        if (!results[scopeId]) {
                            results[scopeId] = {};
                            this.$on("$destroy", function () {
                                delete results[scopeId];
                            });
                        }
                        result = results[scopeId];
                    }

                    for (var groupKey in result)
                        result[groupKey].splice(0, result[groupKey].length);

                    var grpKey = -1; //GroupKey
                    var lastUserId;
                    for (var i = 0; i < data.length; i++) {
                        if (!result[grpKey] || lastUserId && lastUserId != data[i][key]) // Ex.: result[data[0]["UserId"]]{ => return UserId
                            result[++ grpKey] = [];

                        result[grpKey].push(data[i]);
                        lastUserId = data[i][key];
                    }

                    var keys = Object.keys(result);
                    for (var k = 0; k < keys.length; k++) {
                        if (result[keys[k]].length === 0)
                            delete result[keys[k]];
                    }
                    return result;
            };
    });

Sander Elias

unread,
Jul 6, 2015, 9:45:04 AM7/6/15
to ang...@googlegroups.com
Hi Hassan,

If you want to increase your change on getting your question answered, you should demonstrate your problem inside a plunk/fiddle/jsbin/etc.. 
Most people in here have limited time available, and reading trough big wads of code in a message isn't efficient enough.  (nor a fun activity for ones spare time ;) )


Regards
Sander
Reply all
Reply to author
Forward
0 new messages