有人知道是否可以将 Angular Universal 部署到 Github Pages?有像angular-cli-ghpages这样的解决方案,但 IIUC 这些不会为 SEO 预渲染内容。
javascript github-pages typescript angular-universal angular
总体来说,这很简单:
import data from './data.json';
Run Code Online (Sandbox Code Playgroud)
但是,这在Stackblitz Angular项目中不起作用。
链接的项目记录以下内容:
preview-3a0c9433aa42f56dbd90b.js:1 SyntaxError: Unexpected token o in JSON at position 1
Run Code Online (Sandbox Code Playgroud) 我有一个导入很多依赖项的模块,反过来又导入很多依赖项,等等。
当我尝试在 Angular 中使用此模块时,它抱怨某些代码包含已弃用的 if 语句:
:Uncaught SyntaxError: Strict mode code may not include a with statement
Run Code Online (Sandbox Code Playgroud)
有没有办法搜索 VSCode 中的所有节点模块或使用 Linux 命令行实用程序(如sedorfind或 )查找其中包含 with 语句的所有文件。语法如下:
with (object)
statement
Run Code Online (Sandbox Code Playgroud) 在这个演示中,我尝试使用 DefintelyTypedResponse和Request类型作为req, res参数。但是,这不会编译:
const express = require('express');
const app = express();
app.get('/', (req:Request, res:Response) => {
res.send('Hello Express Lovers!');
});
app.listen(3000, () => console.log('server started'));
Run Code Online (Sandbox Code Playgroud)
错误是:
^
TSError: ? Unable to compile TypeScript:
index.ts:4:9 - error TS2339: Property 'send' does not exist on type'Response'.
Run Code Online (Sandbox Code Playgroud) 是否可以直接向mat-step元素添加单击事件处理程序?
我尝试step 2在这个演示中添加一个,但我没有看到点击记录:
我试过的代码:
HTML:
<mat-step label="Step 2" (click)="click()" optional>
// Other stuff
</mat-step>
Run Code Online (Sandbox Code Playgroud)
TS:
click() {
console.log("CLICKED STEP 2")
}
Run Code Online (Sandbox Code Playgroud)
Stackblitz Demo 重现该行为。
https://github.com/angular/components/issues/18080
它仅在第 1 步完成时才有效
我正在尝试util.promisify以下条纹调用,该调用确实成功了:
stripe.customers.create(
{
description: 'My First Test Customer (created for API docs)',
},
function(err, customer) {
console.log(customer)
}
)
Run Code Online (Sandbox Code Playgroud)
IIUC 这应该有效:
const util = require('util')
const createCustomerPromise = util.promisify(stripe.customers.create)
createCustomerPromise(
{
description: 'My First Test Customer (created for API docs)'
}
).then(customer=>console.log(customer))
Run Code Online (Sandbox Code Playgroud)
但是,当我运行上面的命令时,我得到:
(node:28136) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'createResourcePathWithSymbols' of undefined
at /home/ole/Temp/stripetest/node_modules/stripe/lib/StripeMethod.js:27:12
at internal/util.js:286:30
Run Code Online (Sandbox Code Playgroud) 我正在这个对象上max设置:Infinity
let RANGE_DEFAULT_OPTIONS: any = { min: 0, max: Infinity };
console.log(RANGE_DEFAULT_OPTIONS); // {min: 0, max: null}
Run Code Online (Sandbox Code Playgroud)
RANGE_DEFAULT_OPTIONS当记录该对象时,它会记录null该max属性。
这也会记录true:
console.log(RANGE_DEFAULT_OPTIONS.max === Infinity);
Run Code Online (Sandbox Code Playgroud)
那么Infinity和null可以互换吗?
我在 Inkscape 中创建了一个圆圈并关闭了填充,以便只有笔划可见,并将起点设为 45 度,终点设为 315 度。
然后我将其旋转 90 度,这就是最终结果。
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="300" height="300" version="1.1" viewBox="0 0 79.375 79.375" xmlns="http://www.w3.org/2000/svg">
<path transform="rotate(90)" d="m64.961-15.355a34.984 34.412 0 0 1-49.474 1e-6 34.984 34.412 0 0 1-1e-6 -48.666 34.984 34.412 0 0 1 49.474-2e-6" fill="none" opacity=".55814" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="10.583"/>
</svg>
Run Code Online (Sandbox Code Playgroud)
它呈现如下:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="300" height="300" version="1.1" viewBox="0 0 79.375 79.375" xmlns="http://www.w3.org/2000/svg">
<path transform="rotate(90)" d="m64.961-15.355a34.984 34.412 0 0 …Run Code Online (Sandbox Code Playgroud)这是一个例子:
curl -s acme:acmesecret@localhost:9999/uaa/oauth/token
Run Code Online (Sandbox Code Playgroud)
看起来它用于指定URL包含acme:acmesecret(身份验证凭据)部分?
正如查尔斯指出的那样,这些类型的问题很容易用explainhell来回答.所以如果你最终到了这里,你可能会有其他类似的问题,并且解释是要走的路.
我正在Ubuntu 17.10上运行此youtube教程,当我运行build命令时ng build --prod && electron .,结果是:
启动应用程序时出错,无法在/ home / ole / angular-electron中找到Electron应用程序
找不到模块'/ home / ole / angular-electron'
该应用程序编译正常,只是electron .失败的一步。package.json包含main属性的内容如下所示:
"name": "angular-electron",
"version": "0.0.0",
"license": "MIT",
"main": "main.js",
Run Code Online (Sandbox Code Playgroud)
我还尝试按照第一个答案中的指示运行命令,结果如下:
ole@mki:~/angular-electron$ ng build --prod && npm run electron
Date: 2018-02-03T02:57:31.154Z
Hash: a2a64f9c18abdabf8e6e
Time: 25113ms
chunk {0} polyfills.f20484b2fa4642e0dca8.bundle.js (polyfills) 59.4 kB [initial] [rendered]
chunk {1} main.34c2037568943aee5abc.bundle.js (main) 152 kB [initial] [rendered]
chunk {2} styles.9c0ad738f18adc3d19ed.bundle.css (styles) 79 bytes [initial] [rendered]
chunk {3} …Run Code Online (Sandbox Code Playgroud) javascript ×8
typescript ×5
angular ×4
node.js ×3
bash ×1
curl ×1
electron ×1
es6-promise ×1
express ×1
github-pages ×1
html ×1
promise ×1
rest ×1
sed ×1
stackblitz ×1
svg ×1
ubuntu ×1