角度过滤器:小提琴和我的代码有不同的结果

时间:2015-01-15 00:10:39

标签: javascript angularjs

我正在尝试在mean.io项目中构建一个过滤器。当我遇到问题时,我测试了它在小提琴中做一个简单的版本。

但小提琴过滤器效果很好,而不是我的项目...

这是我的小提琴:http://jsfiddle.net/zkwbbt0x/

这是我的项目代码:

 {{global.user._id}} <!-- Working ok, I get the good user Id -->
  <div class="articles list-group liste-articles">
     <a data-ng-repeat="art in articles | contains:global.searchText | filter:{ 'user._id': global.user._id}:true" ng-click="selectByArticle(art)" class="list-group-item lien-article" ng-class="{sel: art._id == article._id}">
     {{art.user._id}}</a> <!-- Working ok, I get the good article.user Id -->
  </div>

我的项目有点复杂,但我找不到它的错误......

有什么想法吗?

ADDITIONAL INFO /

在我的crontroller中我有:

$scope.global = Global;

我的模特是:

文章:

var ArticleSchema = new Schema({
  created: {
    type: Date,
    default: Date.now
  },
  title: {
    type: String,
    trim: true
  },
  content: {
    type: String,
    required: true,
    trim: true
  },
  user: {
    type: Schema.ObjectId,
    ref: 'User'
  },
  images : []
});

用户:

var UserSchema = new Schema({
  name: {
    type: String,
    required: true,
    get: escapeProperty
  },
  email: {
    type: String,
    required: true,
    unique: true

  },
  username: {
    type: String,
    unique: true,
    required: true,
    get: escapeProperty
  },
 [... etc ...]

0 个答案:

没有答案
相关问题