2
我試圖從服務器上的貓鼬模型內使用lodash,_.pluck(...)
,並且我收到「ReferenceError:_ is not defined」。如何在MeanJS中啓用和使用'_'?
從我讀到的,lodash包含在MeanJS。我需要做些什麼特別的事嗎?
我試圖從服務器上的貓鼬模型內使用lodash,_.pluck(...)
,並且我收到「ReferenceError:_ is not defined」。如何在MeanJS中啓用和使用'_'?
從我讀到的,lodash包含在MeanJS。我需要做些什麼特別的事嗎?
想必您需要它就像其他任何模塊一樣。我searched for "lodash" in the MEAN.JS source和這個來了幾次:
var _ = require('lodash');
給它一個鏡頭。
它默認包含在MEAN.JS項目中。生成示例應用程序並查看使用示例。
var mongoose = require('mongoose'),
Article = mongoose.model('Article'),
_ = require('lodash');`