文章内容
2020/5/19 15:14:57,作 者: 黄兵
inmemorydbservice multiple collection
在Angular中使用angular-in-memory-web-api,做后台数据模拟,单个数据集合具体用法可以参考这篇文章:使用Angular in-memory-web-api 无任何数据,在此处不多说。
但是如果angular-in-memory-web-api有多个数据集合,应该如何处理呢?
可以这样处理,具体代码如下:
createDb() {
let heroes = [ .. ];
let crises = [ .. ];
return { heroes, crises };
// or { heroes: heroes, crises: crises }
}返回了多个集合,直接调用就可以了。
参考资料:
评论列表