最佳实践?(best practice? where to store an image in angular?)
我正在学习角度,因为我即将开始使用它的工作项目的船载。 无论如何,我只是玩弄一些东西,并且在确定存储图像文件的最佳位置时遇到了一些麻烦。 我已经成功使用index.html文件和style.css设置背景图像。 但现在我试图在组件级别上使用一些图片,并且只是遇到了一些困难。 任何建议将不胜感激。
I'm currently learning angular as I'm about to start a boat load of projects at work using it. Anyways, I'm just playing around with some stuff and I'm having some trouble figuring out the best place to store an image file. I've had success with the index.html file and the style.css setting a background image. But now I'm trying to use some pictures on the component level and just having some difficulty. Any advice would be greatly appreciated.
原文:https://stackoverflow.com/questions/47656171
最满意答案
在populate上查看Mongoose 文档的“更新参考”部分。
在示例中,您将看到仍然必须保存您创建的
Request
和User
文档。 ( 在示例中,他们首先保存用户'guille'然后在回调中保存'故事'。 )在Mongoose中, SubDocs在父文档保存时保存,但
.populate
不执行此操作。Check the 'Updating Refs' section of the Mongoose documentation on populate.
You will see there, in the example, that you still must save both the
Request
andUser
documents you have created. (In the example, they first save the user 'guille' then in the callback they save the 'story'.)In Mongoose, SubDocs save when a parent doc saves but
.populate
does not do this.
相关问答
更多-
mongodb,mongoosejs返回文档,只返回某些子文档/字段(mongodb, mongoosejs return document and only certain subdocuments/fields)[2022-06-15]
聚合非常复杂,但它基本上管理了您的响应。 尝试这个: model.aggregate([ { $match: { $and: // match multiple {'user': 'bob'}, {'deck.users': 'access_user' } } }, {$project:{ // render each match in this format. output a ... -
如果它只是一个id,你想要排除: query.ne('_id', req.session.user_id); If it's just one id you're looking to exclude: query.ne('_id', req.session.user_id);
-
要将数据作为JSON字符串提供给new routes(...) ,您必须首先解析它: var allroutes = new routes(JSON.parse('{"mode": []}')); routes()实现的Model构造函数需要一个JavaScript Object作为其参数,而不是一个JSON字符串。 参数: doc < Object >用于创建文档的值 您还可以从参数中删除周围的引号,以使用初始化器定义JavaScript对象和数组(JSON从中获取了一些语法): var allrout ...
-
像这样做 *>注意:这将使用goto语句,其他人可能会争辩 使用它但它仍然受支持,只有在没有其他选项时才能使用* private void Window_Load(object sender, EventArgs e) { System.Windows.Forms.SaveFileDialog saveDlg = new System.Windows.Forms.SaveFileDialog(); saveDlg.DefaultExt = ".rtf"; saveDlg.Filter ...
-
MongoDB不会为你的子文档添加_id。 您需要手动添加它。 所以: "steps": [ { "_id": new ObjectId(), "name": "Step 1: Fun Stuff", "dependencies": "1,2,3,4", "resource": "TS", "weight": 0 } ] Link to Article ...
-
是否立即保存文档NSManagedObjectContext?(Enable saving of document NSManagedObjectContext immediately?)[2023-02-10]
所以我愚弄了一段时间,包括尝试@ Aderstedt的建议。 这种方法不起作用,因为伪造通知似乎只是告诉接收上下文“嘿,检查持久性商店,我已更新它们!”,实际上,我没有,因为没有。 我最终找到了一种有效的方法。 不幸的是,它依赖于Lion-only功能,所以我仍然在寻找一种不需要Lion的方法。 背景 我想使用NSPersistentDocument方法。 虽然我没有在任何地方明确地找到这个文档,但我发现了一些论坛帖子,并且经历了一系列经验证据,你不能在属于NSPersistentDocument的上下文中 ... -
在populate上查看Mongoose 文档的“更新参考”部分。 在示例中,您将看到仍然必须保存您创建的Request和User文档。 ( 在示例中,他们首先保存用户'guille'然后在回调中保存'故事'。 ) 在Mongoose中, SubDocs在父文档保存时保存,但.populate不执行此操作。 Check the 'Updating Refs' section of the Mongoose documentation on populate. You will see there, in t ...
-
问题是你需要为你的模型定义一个模式,告诉Mongoose你的_id字段是一个String而不是这个集合中的标准ObjectId : AccountSchema = new mongoose.Schema _id: String profile: available: Boolean Account = mongoose.model 'users', AccountSchema The problem is that you need to define a schema f ...
-
我发现的最佳解决方案是在LESS官方网站上推荐的解决方案: https : //github.com/jgonera/autoless 。 它很简单易用。 它还会监听导入文件中的更改以进行编译。 The best solution out there I've found is the one recommended on the official LESS website: https://github.com/jgonera/autoless. It is dead simple to use. Als ...
-
update的主要好处是它允许您以原子方式修改文档。 规范示例是递增文档的数字字段: save : 调用findOne以获取现有文档。 修改内存中的doc以将1添加到数字字段。 调用save以将更改提交到集合。 随着update : 使用$inc运算符调用update ,以在单个原子步骤中读取,修改和提交。 使用save叶片可能会在三个步骤中发生另一次编辑,然后被save和丢失覆盖。 The key benefit with update is that it allows you to modify a ...