我开始使用angular-cli,我已经阅读了很多内容,以便找到关于我想做什么的答案......没有成功,所以我来到这里.
有没有办法为新模块创建组件?
例如: ng g module newModule
ng g component newComponent (如何将此组件添加到newModule ??)
因为angular-cli默认行为是将所有新组件放入其中app.module.我想选择我的组件的位置,以便我可以创建单独的模块,并且不会将所有组件放在里面app.module.使用angular-cli可以做到这一点,还是我必须手动执行此操作?
我已经实施了一个CanDeactivate警卫,以避免用户在上传过程中离开页面并且它可以工作.问题是我的消息始终是默认消息(由于浏览器语言而在荷兰语中),甚至自己设置消息,仍然显示相同的默认confirm窗口.我想写自己的消息(实际上我有一个我想要显示的模态,但首先我希望看到我的简单消息工作)
任何想法可能是什么?我错过了什么吗?提前致谢!
这是代码
守护.
import { Injectable, ViewContainerRef } from '@angular/core';
import { CanDeactivate } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { DialogService } from '../services';
export interface PendingUpload {
canDeactivate: () => boolean | Observable<boolean>;
}
@Injectable()
export class PendingUploadGuard implements CanDeactivate<PendingUpload> {
constructor(private dialogService: DialogService, private viewContainerRef: ViewContainerRef) { }
canDeactivate(component: PendingUpload): boolean | Observable<boolean> {
return component.canDeactivate()
? true
: confirm("Test custom message");
//dialog I want to use later
//this.dialogService.confirm("modal …Run Code Online (Sandbox Code Playgroud) 我正在努力填充像进度条一样的弧线,因为我不太擅长使用 css。
我遇到了这个: https: //codepen.io/enslavedeagle/pen/AXzaKE
#arc,
#arc::before {
display: block;
box-sizing: border-box;
border-radius: 100%;
width: 100px;
height: 100px;
position: absolute;
background-color: transparent;
padding: 0;
margin: 0;
}
#arc {
border: solid #00BBEE 12px;
clip: rect(0px, 100px, 50px, 0px);
margin: 25px;
}
#arc::before {
content: '';
border: solid black 12px;
top: -12px;
left: -12px;
clip: rect(0px, 100px, 50px, 0px);
transform: rotate(-150deg);
/* define the fill length, using the rotation above.
from -180deg (0% fill) to 0deg (100% fill) */
/* …Run Code Online (Sandbox Code Playgroud)