Note that there are some explanatory texts on larger screens.

plurals
  1. POng-repeat showing functions names and data
    primarykey
    data
    text
    <p>I'm a beginner with angularjs and mongolab ..</p> <p>I have this code, to edit a record in mongolab :</p> <pre><code>function EditCtrl($scope, $location, $routeParams, Project) { var self = this; Project.get({id: $routeParams.projetId}, function(projet) { self.original = projet; $scope.projet = new Project(self.original); }); $scope.save = function() { $scope.projet.update(function() { $location.path('/list'); }); }; } </code></pre> <p>It works perfectly. I wanted to display all the keys and values from the record, this is the code :</p> <pre><code>&lt;div ng-repeat="(key, val) in projet"&gt; &lt;div&gt;{{key}}:{{val}}&lt;/div&gt; &lt;/div&gt; </code></pre> <p>And this is the result :</p> <p>_id:{} destroy: name:Test test rang:4 update:</p> <p>In my record, i only have the _id, name and rang. I don't know why "destroy:" dans "update:" are displayed! probably because i use this code to connect to mongolab :</p> <pre><code>angular.module('mongolab', ['ngResource']). factory('Project', function($resource) { var Project = $resource('https://api.mongolab.com/api/1/databases' + '/_____/collections/_________/:id', {apiKey: '___________________'}, { update: {method: 'PUT'} } ); Project.prototype.update = function(cb) { return Project.update({id: this._id.$oid}, angular.extend({}, this, {_id: undefined}), cb); }; Project.prototype.destroy = function(cb) { return Project.remove({id: this._id.$oid}, cb); }; return Project; }); </code></pre> <p>What should i do to only display the record data ? </p> <p>thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload