当我点击选项卡按钮后,我在这个令人讨厌的蓝色高亮显示div ...我已经在其他论坛中读到我应该将这些问题添加到div中,但它无法正常工作.
.noSelect {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
Run Code Online (Sandbox Code Playgroud)
你可以在这里仔细看看http://omarhabash.com/nova/?page_id=28
我有一个角度通用的应用程序。在构建期间,我尝试firebase-admin
在服务器上使用后遇到各种错误。出于某种原因,我可以在需要 firebase-admin 时构建服务器。
构建角度通用服务器
webpack --config webpack.server.config.js --progress --colors
错误
未找到 ./node_modules/hash-stream-validation/index.js 模块中的警告:错误:无法解析“/Users/ohabash/Dropbox/Sites/fornida-ng6/node_modules/hash-stream”中的“fast-crc32c” -验证'
./node_modules/bytebuffer/dist/bytebuffer-node.js 中的警告未找到模块:错误:无法解析“/Users/ohabash/Dropbox/Sites/fornida-ng6/node_modules/bytebuffer/dist”中的“memcpy”
./node_modules/@grpc/grpc-js/build/src/channel.js 中的错误未找到模块:错误:无法解析“/Users/ohabash/Dropbox/Sites/”中的“../../package” fornida-ng6/node_modules/@grpc/grpc-js/build/src'
./node_modules/@google-cloud/firestore/build/src/v1beta1/firestore_client.js 模块中的错误未找到:错误:无法解析“/Users/ohabash/Dropbox/Sites/fornida-”中的“./firestore_client_config” ng6/node_modules/@google-cloud/firestore/build/src/v1beta1'
./node_modules/google-gax/build/src/operations_client.js 模块中的错误未找到:错误:无法解析“/Users/ohabash/Dropbox/Sites/fornida-ng6/node_modules/google”中的“./operations_client_config” -gax/build/src'
./node_modules/@google-cloud/storage/node_modules/mime/index.js 中的错误未找到模块:错误:无法解析“/Users/ohabash/Dropbox/Sites/fornida-”中的“./types/other” ng6/node_modules/@google-cloud/storage/node_modules/mime'
./node_modules/gtoken/node_modules/mime/index.js 中的错误未找到模块:错误:无法解析“/Users/ohabash/Dropbox/Sites/fornida-ng6/node_modules/gtoken”中的“./types/other” /node_modules/mime'
./node_modules/@google-cloud/storage/node_modules/mime/index.js 中的错误未找到模块:错误:无法解析“/Users/ohabash/Dropbox/Sites/fornida-”中的“./types/standard” ng6/node_modules/@google-cloud/storage/node_modules/mime'
./node_modules/gtoken/node_modules/mime/index.js 中的错误未找到模块:错误:无法解析“/Users/ohabash/Dropbox/Sites/fornida-ng6/node_modules/gtoken”中的“./types/standard” /node_modules/mime'
我认为这样的事情可能是一个很好的解决方案,但我不太了解 webpack。/sf/answers/3111508291/
这也是很好的信息。但没有任何帮助。如果我不能用 webpack 编译,那么还有什么方法可以做到这一点?https://github.com/googleapis/google-cloud-node/issues/1821
更新
我修改webpack.server.config.js
所以 node_modules 不捆绑。
const nodeExternals = require('webpack-node-externals');
module.exports = {
...
externals: [nodeExternals()],
...
}
Run Code Online (Sandbox Code Playgroud)
我认为解决了上述问题,因为该应用程序能够无错误地捆绑。但是现在当我运行构建时,运行时出现错误
错误:找不到模块“zone.js/dist/zone-node”
我正在尝试解决同时打开太多 vscode 窗口的问题。寻找一个 ui 解决方案,让我可以在项目之间快速切换(终端文件等..)
VS code 或任何扩展是否允许我们在一个窗口中打开多个项目?我可以看到我们可以创建一个包含多个项目的工作区,但这行不通,因为像cmd+P
或 find 这样的东西会考虑每个工作区中的所有文件,而且我还需要一组对于“当前项目”而言唯一的终端
我看到一个教程,其中那个人在顶部有一个主选项卡栏。当他点击一个时,整个新项目就会被加载;但是我不知道这是怎么做到的。
这是我的节点server.js
,它位于项目根目录中,有自己的 npm 配置。所有 Angular 文件都在dist/client
之后ng build
client/dist
const express = require('express');
const colors = require('colors');
const bodyParser = require('body-parser');
const path = require('path');
const cors = require('cors');
const PORT = process.env.port||'3200';
// init "app"
const app = express();
app.use(cors({origin: `http://localhost:4200`}));
// angular entry point
app.use(express.static(path.join(__dirname, 'client/dist')));
//parse incoming data before routes
app.use(bodyParser.json())
// api routes
app.use('/api',require('./api/api'));
// error middleware
app.use(function(err, req, res, next){
console.log(`${err}`.red.bold)
res.status(422).send({error: err.message });
});
// listen
app.listen(PORT, function(){
console.log(`app running on …
Run Code Online (Sandbox Code Playgroud) 我不是在寻找有关如何设置它的具体教程.我其实想知道什么是可能的,什么不可能.
在我的Angular 6应用程序中,我正在学习如何加载内容服务器,因此机器人可以索引客户端数据.api请求中有很多数据我想要被抓取.例如,以下代码从我的电子商务API获取当前页面项目数据.
getProductById(product_id) {
const data = { product_id: product_id };
return this.http.get<any>( api_url + '/getProductById', {params: data} );
}
Run Code Online (Sandbox Code Playgroud)
这是对我的api的调用,它从BigCommerce返回数据(见下文)
getProductById = (req, res, next) => {
let product_id = req.query.product_id;
return bc_v3.get(`/catalog/products/${product_id}`).then(data => {
return data; // this data will then return back to the client async
});
};
Run Code Online (Sandbox Code Playgroud)
从API返回的数据是否可以被SEO机器人索引?
我的角度应用程序将 jquery 用于需要它作为依赖项和其他客户端任务的各种插件。
问题是,universal 无法理解要做什么,因为 jquery 操作服务器端不存在的 dom 元素。
错误参考错误:$未定义
最终目标只是忽略服务器端的 jquery 任务。我读过建议将所有 dom 操作放在仅限客户端的服务中的解决方案,以及使用if (isBrowser) { /* jQuery here */ }
...的另一个解决方案,但这对于包装每个 dom 情况并不理想。
https://medium.com/@zainzafar/localstorage-with-angular-universal-2a111fb4af72
这两个都是不错的想法,但我正在寻找更优雅的东西。这将忽略 jquery ($) 而不会出错。例如,以下补丁(放入server.ts
)每次都不会出错document
或被window
使用。无需修改客户端文件即可忽略服务器端。
const domino = require('domino');
const fs = require('fs');
const path = require('path');
const template = fs.readFileSync('./dist/browser/index.html').toString();
const win = domino.createWindow(template);
global['window'] = win;
global['document'] = win.document;
Run Code Online (Sandbox Code Playgroud)
在你告诉我不要使用 jQuery 之前。相信我。我知道。但这个决定不在我手中,这不是我在这里要求的。
我遇到了这篇文章。他找到了一个简单的解决方案来抑制本地存储错误和窗口错误...我正在寻找像这样的 jquery 解决方案 https://blog.khophi.co/localstorage-undefined-angular-server-side-rendering/
我需要在以下对象中创建所有键(不是值)的数组,其中键以_下划线开头...
在以下代码段中,我尝试getSubscriptions()
返回["_foo1", "_foo2"]
let myObj = {
foo0: 'test',
_foo1: 'test',
_foo2: 'test',
foo3: 'test',
};
function getSubscriptions(obj, cb) {
// should return ["_foo1", "_foo2"]
let ret = ["foo1", "_foo2"];
return cb(ret);
}
getSubscriptions(myObj, (ret) => {
if (match(ret, ["_foo1", "_foo2"]) ) {
$('.nope').hide();
return $('.works').show();
}
$('.nope').show();
$('.works').hide();
});
function match(arr1, arr2) {
if(arr1.length !== arr2.length) { return false; }
for(var i = arr1.length; i--;) {
if(arr1[i] !== arr2[i]) { return false;}
}
return true;
} …
Run Code Online (Sandbox Code Playgroud)@import 'packages/bulma.sass';
@charset "utf-8"
/*! bulma.io v0.6.1 | MIT License | github.com/jgthms/bulma */
@import "sass/utilities/_all"
@import "sass/base/_all"
@import "sass/elements/_all"
@import "sass/components/_all"
@import "sass/grid/_all"
@import "sass/layout/_all"
Run Code Online (Sandbox Code Playgroud)
'错误:client / packages / bulma.sass.scss不存在!
是否有可能导入SASS
到一个SCSS
文件?将bulma安装到scss env中的最佳方法是什么。
我也尝试过@import 'packages/bulma'
,并得到client/packages/bulma.scss doesn\'t exist!
。
我在尝试使用时收到以下消息auth.linkWithPhoneNumber()
。同一域上的所有其他身份验证服务都工作正常。
auth/captcha-check-failed 和“找不到主机名匹配”错误
https://github.com/firebase/quickstart-js/issues/394
现在我知道这个问题是全部参考,但解决方案对我不起作用...我不断找到的解决方案是更新Authorized Domains
,但是有两个原因可能不是此应用程序的解决方案。
通过电话登录可以在本地主机上运行,但不能在产品中运行
更新授权域时,更改不会保存。相反,我得到以下内容
更新授权域列表时出错
如果解决方案auth/captcha...
是更新域,那么为什么我不能在那里保存更改?如果这可能不是解决方案那么你知道它可能是什么吗
<pre *ngIf="isAdmin()">{{email|json}} - {{user|json}}</pre>
Run Code Online (Sandbox Code Playgroud)
isAdmin() {
console.log('isAdmin: ', this.bcAuthService.isAdmin());
return this.bcAuthService.isAdmin();
}
Run Code Online (Sandbox Code Playgroud)
isAdmin() {
return this.admins.includes(localStorage.getItem("email"));
}
Run Code Online (Sandbox Code Playgroud)
组件中的函数会多次打印。为什么?这是错误的吗?什么是更好的方法?