{"action":"created","issue":{"url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1142","labels_url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1142/labels{/name}","comments_url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1142/comments","events_url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1142/events","html_url":"https://github.com/Urigo/angular-meteor/issues/1142","id":129097277,"number":1142,"title":"ng-repeat weird behavior","user":{"login":"SimoneGatti","id":16915705,"avatar_url":"https://avatars.githubusercontent.com/u/16915705?v=3","gravatar_id":"","url":"https://api.github.com/users/SimoneGatti","html_url":"https://github.com/SimoneGatti","followers_url":"https://api.github.com/users/SimoneGatti/followers","following_url":"https://api.github.com/users/SimoneGatti/following{/other_user}","gists_url":"https://api.github.com/users/SimoneGatti/gists{/gist_id}","starred_url":"https://api.github.com/users/SimoneGatti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimoneGatti/subscriptions","organizations_url":"https://api.github.com/users/SimoneGatti/orgs","repos_url":"https://api.github.com/users/SimoneGatti/repos","events_url":"https://api.github.com/users/SimoneGatti/events{/privacy}","received_events_url":"https://api.github.com/users/SimoneGatti/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-27T10:22:06Z","updated_at":"2016-01-27T12:39:40Z","closed_at":null,"body":"Hi all!\r\nI created my first meteor app and I chose to use angular package.\r\nI have 2 simple page: the first that lists items and allows to add and remove one of them, the second that shows item details. When the first page is loaded I see all items correctly. After I visited the details page, then ng-repeat show only one item duplicated many time. How you can see below (name - id).\r\n\r\n<img width=\"1143\" alt=\"before\" src=\"https://cloud.githubusercontent.com/assets/16915705/12609781/34d9255a-c4e4-11e5-996a-1db54c91327b.png\">\r\n<img width=\"1141\" alt=\"after\" src=\"https://cloud.githubusercontent.com/assets/16915705/12609787/3d83c836-c4e4-11e5-99e1-0c265e86909a.png\">\r\n\r\nI logged the mongo cursor returned by helpers function (still the same):\r\n<pre>\r\nret>0>wfwefwe\r\nret>1>eeeee\r\nret>2>geggggggg\r\nret>3>wwwww\r\n</pre>\r\n\r\nDid you find the same behavior before now? What to you think about that?\r\n(When I used angular-with-blaze package, I was having the same behavior simply adding new item)\r\n\r\nI can provide some snippet of code:\r\n<ul>\r\n<li><b>template</b><pre>\r\n&lt;div class=\"reports-list container\"&gt;\r\n    &lt;div class=\"panel panel-primary\"&gt;\r\n        &lt;div class=\"panel-heading\"&gt;\r\n            &lt;h3 class=\"panel-title\"&gt;\r\n                &lt;i class=\"fa fa-tasks\"&gt;&lt;/i&gt; {{ \"REPORTS\" | translate | capitalize }}\r\n                &lt;i class=\"fa fa-plus-circle yo-right yo-link\" ng-click=\"addReport()\" uib-tooltip='{{ \"ADD_REPORT\" | translate | capitalize }}'&gt;&lt;/i&gt;\r\n            &lt;/h3&gt;\r\n        &lt;/div&gt;\r\n        &lt;div class=\"panel-body\"&gt;\r\n            &lt;ul class=\"nav nav-tabs nav-stacked col-md-12 col-sm-12\"&gt;\r\n                &lt;li ng-repeat=\"report in reports\"&gt;\r\n                    &lt;p&gt;\r\n                        &lt;a ui-sref=\"reports.detail({ reportId: report._id })\"&gt;{{ report.name }}&lt;/a&gt;\r\n                        &lt;i class=\"yo-right\" ng-class=\"report.chiuso == true ? 'fa fa-check-circle yo-true' : 'fa fa-close yo-false'\"&gt;&lt;/i&gt;\r\n                        &lt;button class=\"btn btn-sm btn-danger\" ng-click=\"remove(report._id)\"&gt;{{ \"BUTTON_REMOVE\" | translate | capitalize }}&lt;/button&gt;\r\n                    &lt;/p&gt;\r\n                &lt;/li&gt;\r\n            &lt;/ul&gt;\r\n        &lt;/div&gt;\r\n    &lt;/div&gt;\r\n    &lt;p&gt;{{ \"TOTAL_NUMBER_OF_REPORTS\" | translate | capitalize }}: {{reports.length}}&lt;/p&gt;\r\n&lt;/div&gt;\r\n</pre></li>\r\n<li><b>ui-router</b><pre>\r\n.config ($stateProvider) ->\r\n  $stateProvider\r\n  .state 'reports',\r\n    url: '/reports'\r\n    abstract: true\r\n    template: '<ui-view/>'\r\n  .state 'reports.list',\r\n    url: '/list'\r\n    templateUrl: 'client/reports/reports-list.view.ng.html'\r\n    controller: 'ReportsListCtrl'\r\n  .state 'reports.detail',\r\n    url: '/detail/:reportId'\r\n    templateUrl: 'client/reports/report-detail.view.ng.html'\r\n    controller: 'ReportDetailCtrl'\r\n</pre></li>\r\n<li><b>model (client and server)</b><pre>\r\n@Reports = new Mongo.Collection('reports')\r\nMeteor.methods\r\n  'reports.remove': (reportId) ->\r\n    Reports.remove reportId\r\n</pre></li>\r\n<li><b>client</b><pre>\r\n.controller 'ReportsListCtrl', ($scope) ->\r\n  $scope.subscribe('reports')\r\n\r\n  $scope.helpers({\r\n    reports: () ->\r\n      Reports.find({'user._id': Meteor.userId()})\r\n  })\r\n    \r\n  $scope.remove = (reportId) ->\r\n    Meteor.call('reports.remove', reportId)\r\n\r\n  $scope.addReport = () ->\r\n    tName = moment().format(\"MMMM\") + \" \" + moment().format(\"YYYY\")\r\n    Meteor.call('reports.insert', Meteor.user(), tName, (error, result) ->\r\n      if error\r\n        console.log error\r\n      else\r\n        console.log result\r\n        if !result\r\n          console.log result'REPORT_ALREADY_EXISTS'\r\n    )\r\n</pre></li>\r\n<li><b>server</b><pre>\r\nMeteor.publish('reports', () ->\r\n  Reports.find()\r\n)\r\nReports.allow\r\n  insert: (userId, report) ->\r\n    userId\r\n  update: (userId, report, fields, modifier) ->\r\n    userId\r\n  remove: (userId, report) ->\r\n    userId\r\n\r\nMeteor.methods\r\n  'reports.myReportExists': (userId, tName) ->\r\n    Reports.find({'user._id': userId, name: tName}).count() > 0\r\n\r\n  'reports.insert': (user, tName) ->\r\n    exists = Meteor.call('reports.myReportExists', user._id, tName)\r\n    if exists\r\n      return false\r\n    else\r\n      currentDate = moment()\r\n      days = []\r\n      _.times(currentDate.daysInMonth(), (d) ->\r\n        isFestivity = false\r\n        dataActual = moment().date(d+1).toDate()\r\n        tzoffset = (new Date()).getTimezoneOffset() * 60000;\r\n        dataActual.setHours(0)\r\n        dataActual.setMinutes(0)\r\n        dataActual.setSeconds(0)\r\n        dataActual.setMilliseconds(0)\r\n\r\n        dataActual = new Date(dataActual - tzoffset)\r\n\r\n        days.push {\r\n            datetime: moment().date(d+1).toDate()\r\n            dayOfWeek: moment().date(d+1).format(\"d\")\r\n            festivo: false\r\n            ore: \"\"\r\n            ore_straordinario: \"\"\r\n            ore_viaggio: \"\"\r\n            trasferta: \"\"\r\n            km: \"\"\r\n            parcheggi: \"\"\r\n            pedaggi: \"\"\r\n            trasporti: \"\"\r\n            ristorazione: \"\"\r\n            pernottamento: \"\"\r\n            note: \"\"\r\n          }\r\n      )\r\n      Reports.insert {\r\n          name: tName\r\n          user: user\r\n          chiuso: false\r\n          table: days\r\n        }\r\n      return true\r\n</pre></li>\r\n</ul>"},"comment":{"url":"https://api.github.com/repos/Urigo/angular-meteor/issues/comments/175598502","html_url":"https://github.com/Urigo/angular-meteor/issues/1142#issuecomment-175598502","issue_url":"https://api.github.com/repos/Urigo/angular-meteor/issues/1142","id":175598502,"user":{"login":"ozsay","id":3464930,"avatar_url":"https://avatars.githubusercontent.com/u/3464930?v=3","gravatar_id":"","url":"https://api.github.com/users/ozsay","html_url":"https://github.com/ozsay","followers_url":"https://api.github.com/users/ozsay/followers","following_url":"https://api.github.com/users/ozsay/following{/other_user}","gists_url":"https://api.github.com/users/ozsay/gists{/gist_id}","starred_url":"https://api.github.com/users/ozsay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ozsay/subscriptions","organizations_url":"https://api.github.com/users/ozsay/orgs","repos_url":"https://api.github.com/users/ozsay/repos","events_url":"https://api.github.com/users/ozsay/events{/privacy}","received_events_url":"https://api.github.com/users/ozsay/received_events","type":"User","site_admin":false},"created_at":"2016-01-27T12:39:40Z","updated_at":"2016-01-27T12:39:40Z","body":"Can you provide the full app as a repository? (include all views and controllers)"}}