1

我有我这样检索的对象$scope.posts = posts.query()

帖子是 ngResrouce

angular.module('flapperNews')
.factory('posts', ['$resource', function($resource) {
    return $resource('api/posts.json/:id', {id: "@id"})
}]);

检索到的对象

[
        0: {
            $hasKey: "object:4",
            title: "some text",
            content: "hello world there",
            upvotes: 0
        }
        1: {
            $hasKey: "object:5",
            title: "Lorem ipsum is dolor",
            content: "hello world there",
            upvotes: 0
        }
        2: {
            $hasKey: "object:6",
            title: "When there is nothing to share",
            content: "hello world there",
            upvotes: 0
        }
    ]

如何从这个检索到的对象中获取“标题”,以便可以将其用于 AngularJS Formly 验证?(验证新帖子标题是否是唯一的)

4

0 回答 0