javascript - ngRepeat:dupes even with track by $index (special case) -


Short background: - Creating a social networking site and I am storing conditions and users with MongoDB . For example, "URL", "Profile URL": "AC 271A307", "Tips": [], "Time": "2013-10-28 T22: 25: 24.278Z", "Active": True "Owner": DBRF ("user", "ABC @ EEGEG"), // Mongo DB users collection "_id" reference: object ID ("526ee454da46f33bf8000002")}

Angle is doing;

  & lt; Li ng-repeat = "position in position | isUserStatus track by position ['_id']" ng-show = "statusactive" square = "user-state-bland" & gt; // Here I display the user data and status itself. & Lt; / Li & gt;   

Note: This works all right

But this is the problem. I'm using Websock to automatically update and add new statuses to $ RootScope.statuses.

  socket.on ('new condition', function (position) {$ timeout (function () ($ rootScope). $ Apply (function () {// at the top of all positions New status pile. $ RootScope.statuses.unshift (position);});}, 0);})   

Now if you include 'status' inside the websocket callback console.log (), Then I get the position and it appears twice. In a way that the websocket was sent twice (from which I have no control) So when it is placed inside "$ rootScope.statuses", then when I get an error "Error: [NGREPAT: Deep] Repeater is not allowed in duplicates. By specifying expression to specify unique key Use 'track'. " I do not understand this because I am actually using the $ track by status [$ _ ID] "post-text" itemprop = "text">

@Buddhivani The lowest comment (below my question) takes me to the right path to fix my problem. I made the plugin available by adding the plugin and using its "unique" filter. It was decided that NGERPAT Duplex errors have been fixed. But again, I still see duplicate conditions displayed for some reason (but there is no error on the console). So if I post for "Hello" example, I'll have to look "Hello" twice. I had managed to fix it completely, but fixing that problem is different and beyond the scope of this question.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -