我正在使用Angular 4构建一个webapp.我有一个顶级路由模块和一个单独的路由模块,用于每个子模块(例如HomeModule).
这是我的顶级路由配置:
export const ROUTES: Routes = [
{path: '', loadChildren: './home#HomeModule'},
{path: '**', component: NotFoundComponent},
];
Run Code Online (Sandbox Code Playgroud)
当我跑ng server
,我得到一个奇怪的错误,home
找不到该模块.该应用程序无法在浏览器中运行.
奇怪的部分如下:当文件被更改并且webpack重新编译项目时,一切正常并且路由工作.
该错误仅在我运行时出现ng serve
.
这是我运行时遇到的错误ng serve
,而不是因为文件更改而重新编译项目的错误:
ERROR in Error: Could not resolve module ./home relative to /path/to/my/project/src/app/app.module.ts
at StaticSymbolResolver.getSymbolByModule (/path/to/my/project/node_modules/@angular/compiler/bundles/compiler.umd.js:31884:30)
at StaticReflector.resolveExternalReference (/path/to/my/project/node_modules/@angular/compiler/bundles/compiler.umd.js:30350:62)
at parseLazyRoute (/path/to/my/project/node_modules/@angular/compiler/bundles/compiler.umd.js:28616:55)
at listLazyRoutes (/path/to/my/project/node_modules/@angular/compiler/bundles/compiler.umd.js:28578:36)
at visitLazyRoute (/path/to/my/project/node_modules/@angular/compiler/bundles/compiler.umd.js:29995:47)
at AotCompiler.listLazyRoutes (/path/to/my/project/node_modules/@angular/compiler/bundles/compiler.umd.js:29963:20)
at AngularCompilerProgram.listLazyRoutes (/path/to/my/project/node_modules/@angular/compiler-cli/src/transformers/program.js:157:30)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/path/to/my/project/node_modules/@angular/compiler-cli/src/ngtools_api.js:44:36)
at AngularCompilerPlugin._getLazyRoutesFromNgtools (/path/to/my/project/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:247:66)
at Promise.resolve.then.then (/path/to/my/project/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:538:50)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我遇到了一个问题,并将其简化为以下代码:
trait Logger {}
struct DefaultLogger;
impl Logger for DefaultLogger {}
struct A<L> where L: Logger {
logger: Box<L>,
}
impl<L> A<L> where L: Logger {
fn new() -> Self {
let logger = DefaultLogger;
A {
logger: Box::new(logger),
// ^^^^^^ Here is the problem
}
}
}
fn main() {
let a = A::new();
}
Run Code Online (Sandbox Code Playgroud)
产生以下错误:
trait Logger {}
struct DefaultLogger;
impl Logger for DefaultLogger {}
struct A<L> where L: Logger {
logger: Box<L>,
}
impl<L> A<L> where L: …
Run Code Online (Sandbox Code Playgroud) 运行时bundle exec fastlane build
,fastlane 打印如下错误信息(引号之间的字符为 U+200B 零宽度空格):
[!] Could not find action, lane or variable '?'. Check out the documentation for more details: https://docs.fastlane.tools/actions
Run Code Online (Sandbox Code Playgroud)
快车道:2.130.0
宝石:3.0.6
有没有人遇到过这个问题?如果是,你是如何解决的?
提前致谢
我正在写一个玩具操作系统.由于有很多c文件,gcc命令没有改变(文件名除外),有没有办法自动选择目录中的所有.c文件并编译和链接它们?示例:我创建了一个新文件,example.c我打电话
make
Run Code Online (Sandbox Code Playgroud)
而makefile为我做了一切.
我不想使用脚本,只需要使用makefile.
OBJECTS=kasm.o kc.o objects/kb.o objects/screen.o objects/string.o objects/system.o objects/util.o objects/idt.o objects/isr.o
ARGS=-ffreestanding
CC=gcc
TARGET=image/boot/kernel.bin
$(TARGET): $(OBJECTS)
ld -m elf_i386 -T link.ld -o $(TARGET) $(OBJECTS)
kasm.o: kernel.asm
nasm -f elf32 kernel.asm -o kasm.o
kc.o: kernel.c
gcc -m32 -c kernel.c -o kc.o $(ARGS)
objects/kb.o: include/kb.c include/kb.h
gcc -m32 -c include/kb.c -o objects/kb.o $(ARGS)
objects/screen.o: include/screen.c include/screen.h
gcc -m32 -c include/screen.c -o objects/screen.o $(ARGS)
objects/string.o: include/string.c include/string.h
gcc -m32 -c include/string.c -o objects/string.o $(ARGS)
objects/system.o: include/system.c include/system.h
gcc -m32 -c include/system.c …
Run Code Online (Sandbox Code Playgroud) 我的WebApp需要通过ProtBuf与我的服务器通信。为此,我需要能够发布原始二进制数据。
这是我现在正在使用的代码。这个问题是HttpClient
将Uint8Array编码为JSON数组,因此结果不再是有效的原型缓冲区:
const message = LoginRequest.fromObject({
code: code,
username: username,
password: password
});
const buffer: Uint8Array = LoginRequest.encode(message).finish();
this.http.post('https://api.myserver.com', buffer)
.subscribe(/*...*/);
Run Code Online (Sandbox Code Playgroud)
HttpClient.post
接受一些选项,在这里可以设置responseType
到json
,text
,blob
或arraybuffer
。但这只是设置了预期的响应类型,请求的主体仍被编码为JSON。
是否HttpClient
可以发送未编码的正文?
编辑:这是我在服务器上收到的正文:
{"0":10,"1":3,"2":97,"3":98,"4":99,"5":18,"6":5,"7":97,"8":100,"9":109,"10":105,"11":110,"12":26,"13":8,"14":112,"15":97,"16":115,"17":115,"18":119,"19":111,"20":114,"21":100}
我想为我的应用程序中的活动设置动画。如果我开始活动,这绝对没问题,但是当我尝试完成它时,android 首先向我显示标准,然后显示淡入淡出动画。
@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(android.R.anim.fade_out, android.R.anim.fade_in);
}
Run Code Online (Sandbox Code Playgroud)
你有答案吗?