试图在AngularJS项目中使用TaffyDB,但是我无法让Taffy工作。

每当我尝试从TaffyDB获取数据时,它都是空的:

Object {extend: undefined, insert: undefined}


我只是想从他们的website做一个简单的测试:

<script src="vendors/taffydb-master/taffy.js"></script>

<script>
    $(document).ready(function () {
        //TaffyDB
        var friends = TAFFY([
            {"id":1,"gender":"M","first":"John","last":"Smith","city":"Seattle, WA","status":"Active"},
            {"id":2,"gender":"F","first":"Kelly","last":"Ruth","city":"Dallas, TX","status":"Active"},
            {"id":3,"gender":"M","first":"Jeff","last":"Stevenson","city":"Washington, D.C.","status":"Active"},
            {"id":4,"gender":"F","first":"Jennifer","last":"Gill","city":"Seattle, WA","status":"Active"}
        ]);

        console.log(friends());
    });
</script>


我究竟做错了什么?

最佳答案

更改

console.log(friends());


代替做

console.log(friends().get());

09-25 22:10