如何找到以下错误报告的错误?
GET http://localhost:8080/img/%7B%7BCurrentPage.img%7D%7D 404 (Not Found) angular.js:2763
r.html angular.js:2763
S.(anonymous function) angular.js:2810
(anonymous function) angular-ui-router.min.js:7
N angular.js:6711
g angular.js:6105
(anonymous function) angular.js:6001
j angular-ui-router.min.js:7
(anonymous function) angular-ui-router.min.js:7
k.$broadcast angular.js:12981
u.transition.L.then.u.transition.u.transition angular-ui-router.min.js:7
F angular.js:11573
(anonymous function) angular.js:11659
k.$eval angular.js:12702
k.$digest angular.js:12514
k.$apply angular.js:12806
h angular.js:8379
u angular.js:8593
z.onreadystatechange angular.js:8532
Run Code Online (Sandbox Code Playgroud)
的%7B%7BCurrentPage.img%7D%7D是{{CurrentPage.img}},它返回图像名称和工作,这是为什么错误在我的控制台?
这个问题有很多答案,但我无法弄清楚如何解决两个问题.经过研究我构建了非常简单的指令.
.directive('keypressEvents', function ($document) {
return {
restrict: 'A',
link: function () {
$document.bind('keypress', function (e) {
alert(e.keyCode);
});
}
}
});
Run Code Online (Sandbox Code Playgroud)
第一个问题更像是一个问题,如果我做到了angular.service('myService', myServiceFunction);,它会在全球范围内运作吗?第二个是一些键不工作,如ESC,箭头ctrl等我正在研究这个CODEPEN
我试图成功的设置是创建一个创建数据库的节点进程,其他服务器以安全的方式访问这些数据库.
所以我的想法是用一个用户和传递从节点创建数据库.然后打开服务器mongodb端口以打开访问并锁定mongo admin用户.如果这个理论是好的:
/etc/mongodb.conf我应该只添加bind_ip = 0.0.0.0,这一切?PS:我正在使用Ubuntu 16:04和最新的Mongodb.
编辑:13/08/17
我到目前为止取得的成功是addUser= db.createUser({user: "admin",pwd: "admin",roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]});对于管理数据库,在数据库处于此状态时与其连接--auth并尝试通过该连接创建其他数据库,如下所示.
var adminConnection = mongoose.createConnection('mongodb://admin:admin@localhost:27017/admin', {
useMongoClient: true
});
console.log(typeof adminConnection.db.executeDbAdminCommand);//function
Run Code Online (Sandbox Code Playgroud) 我试图在我的nodejs项目上设置较少,当我从浏览器less-middleware调试请求我的页面时显示错误的路径和dest路径.当我'/public/css/index.css'从我的网页上询问时,我添加'/public/css/'了源路径.以下是我的配置:
app.use(lessMiddleware(__dirname+'/server/less',{
debug: true,
dest: __dirname+'/public/css',
once: true
}));
Run Code Online (Sandbox Code Playgroud)
调试屏幕显示:
pathname : /public/css/index.css
source : D\Work\project\server\less\public\css\index.less
destination : D\Work\project\public\css\public\css\index.css
Run Code Online (Sandbox Code Playgroud)
即使我修复目标路径,我有源问题,我不想把我的较少的文件放入公共文件夹.有没有办法/public/css从编译少删除.我试图添加:
'preprocess.path': function(pathname, req){
console.log(pathname);
}
Run Code Online (Sandbox Code Playgroud)
但console.log从未表现出来.也许有一种方法可以不编译用户要求的每个css文件,只需编译那些文件较少的文件.
PS我正在使用的每个模块都在"*"版本之下.
nodejs 上可以有多个线程吗?我正在使用 expressjs 和 multer 进行图像上传。当图片很大并且网页需要完成另一个请求时,它会等待图片上传。可以使用其他线程使图像上传吗?
我尝试了很多东西,比如计算位置,处理原始fabricjs中的事件.以前有没有这样做过?
例如,我有 SchemaA 和 SchemaB,它们都属于不同的数据库。在 SchemaA 里面我有doc.b = {type: mongoose.Schema.Types.ObjectId, ref: 'SchemaB'}。当我做这个填充时,我得到了以下错误。MissingSchemaError: Schema hasn't been registered for model "SchemaB". Use mongoose.model(name, schema)从我的研究中,我读到 mongoose 支持人口跨数据库。
我需要为每个模式多次使用猫鼬,这是问题吗?
基本上我需要的是两种不同的模式,它们连接到不同的数据库以与填充一起工作。如果我在 mongoose 创建的连接上注册架构,它们将不会注册在同一个列表中。如果有成功的方法那?
我在客户端使用它,我的 pdf 文件将只包含图像。无论我添加多少,第一个图像的宽度与高度相反。而从第二个和更远的地方一切看起来都不错。
我正在使用的配置是:
var content = [];
for (var j = 0; j < pages.length; j++) {
if(pages[j].dataUrl) content.push({
image: pages[j].dataUrl,
width: 891,
height: 630
});
}
var docDefinition = {
pageSize: {
width: 891,
height: 630
},
pageOrientation: 'landscape',
pageMargins: [ 0, 0, 0, 0 ],
content: content
};
pdfMake.createPdf(docDefinition).open();
Run Code Online (Sandbox Code Playgroud) 在我的示例中,我有一个登录视图电子邮件或用户名可以发送两个之一.
User.findOne({ 'email' : email }, function(err, user) {
// awesome user
});
Run Code Online (Sandbox Code Playgroud)
我需要这样的东西:
User.findOne({ 'email' : email } || {'username' : email}, function(err, user) {
// awesome user
});
Run Code Online (Sandbox Code Playgroud) 我正在测试下载速度res.sendFile(src);,fs.createReadStream(src).pipe(res);并且我没有看到太大的区别.哪个更好地提供文件,为什么?如果我有大文件,流会更好地处理它?