我正在对Postgre DB执行查询以获取早于特定日期的数据。
这是我的功能
async filesListToDelete(): Promise<any> {
return await this.fileRepository.find({
where: { last_modified: { $lt: '2018-11-15 10:41:30.746877' } },
});
}
Run Code Online (Sandbox Code Playgroud)
这是我定义文件实体的方式:
export class File {
@PrimaryGeneratedColumn()
id: number;
@Column({ nullable: false })
idFonc: number;
@Column({ nullable: false })
version: number;
@Column('varchar', { length: 100, nullable: false })
filename: string;
@Column({ nullable: true })
last_modified: Date;
@Column({ nullable: false })
device: boolean;
@ManyToOne(type => Type, { nullable: false })
@JoinColumn({ referencedColumnName: 'id' })
type: Type;
@OneToMany(type => FileDevice, …Run Code Online (Sandbox Code Playgroud) 我正在使用 ngrx 商店。
在我的状态下,我必须物品
export interface ISchedulesState {
schedulings: ISchedules;
actualTrips: ISchedule[];
}
Run Code Online (Sandbox Code Playgroud)
这是我的接口
export interface ISchedules {
[key: string]: ISchedule[];
}
export interface ISchedule {
dest: number;
data: string
}
Run Code Online (Sandbox Code Playgroud)
在减速器中我更新 actualTrips
export const SchedulingReducers = (
state = initialSchedulingState,
action: SchedulesAction
): ISchedulesState => {
switch (action.type) {
case ESchedulesActions.GetSchedulesByDate: {
return {
...state
};
}
case ESchedulesActions.GetSchedulesByDateSuccess: {
return {
...state,
schedulings: action.payload
};
}
case ESchedulesActions.GetSchedulesByTime: {
let time = action.payload;
state.actualTrips = [...(state.schedulings[time] || [])]; …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 TypeORM删除file依赖于表的表上的记录fileDevice。
其实我得到这个错误
“更新或删除表“文件”违反表“文件设备”上的外键约束“FK_4dcd99898oij89898909c2603”
这是我声明表的方式:
export class File {
@PrimaryGeneratedColumn()
id: number;
@Column()
idFonc: number;
@Column()
version: number;
@Column('varchar', { length: 100 })
filename: string;
@Column({ nullable: true })
lastModified: Date;
@Column()
device: boolean;
@Column({ nullable: false })
typeId: number;
@ManyToOne(type => Type)
@JoinColumn({ referencedColumnName: 'id' })
type: Type;
@OneToMany(type => FileDevice, filedevice => filedevice.file)
fileDevice: Promise<FileDevice[]>;
}
Run Code Online (Sandbox Code Playgroud)
和文件设备
export class FileDevice {
@PrimaryGeneratedColumn()
id: number;
@ManyToOne(type => File, f => f.fileDevice, {
nullable: false,
onDelete: …Run Code Online (Sandbox Code Playgroud) 我会使用Typedjs以角度2制作打字机效果
如网站所示,我已经用npm安装了包:
npm install typed.js
Run Code Online (Sandbox Code Playgroud)
然后我将此代码添加到我的组件:
import Typed from 'typed.js';// not sure if it's the right way
Run Code Online (Sandbox Code Playgroud)
和
ngOnInit() {
var typed = new Typed(".element", {
strings: ["This is a JavaScript library", "This is an ES6 module"],
smartBackspace: true // Default value
});
}
Run Code Online (Sandbox Code Playgroud)
然后在我的html文件中:
<div id="typed-strings">
<p>Typed.js is an <strong>Awesome</strong> library.</p>
<p>It <em>types</em> out sentences.</p>
</div>
<span id="typed"></span>
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
/home/haddad/projects/siteperso/src/app/slide-presentation/slide-presentation.component.ts (18,21): Cannot find name 'Typed'.
PS:我对任何其他与Typed.js做同样工作并与Angular 2/4合作的提议持开放态度
我会在 NestJS 中调用拦截器内的服务(请参阅文档),这就是我的制作方法
export class HttpInterceptor implements NestInterceptor {
constructor(private configService:ConfigService){}
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
let request = context.switchToHttp().getRequest();
const apikey= this.configService.get('apikey');
const hash=this.configService.get('hash');
request.params= {apikey:apikey ,hash:hash,ts:Date.now()}
return next
}
}
Run Code Online (Sandbox Code Playgroud)
她的 ConfigService
export class ConfigService {
private readonly envConfig: { [key: string]: string };
constructor(filePath: string) {
this.envConfig = dotenv.parse(fs.readFileSync(path.join(__dirname, filePath)));
}
get(key: string): string {
return this.envConfig[key];
}
}
Run Code Online (Sandbox Code Playgroud)
我收到一个错误,指出 configService 未定义
无法读取未定义的属性“get”
但我已经ConfigService正确实例化了
我不知道为什么我不能ConfigService在拦截器内部使用
我有一个列表,我希望列表中的每个元素都可以单击,并具有像垫按钮组件一样的连锁反应。
我试过这个:
<mat-list role="list" *ngFor="let userS of Projet?.backlog.userStory; let i=index">
<button mat-button>
<mat-list-item role="listitem">User Story #{{i}} : {{userS.userStory}} </mat-list-item>
</button>
</mat-list>
Run Code Online (Sandbox Code Playgroud)
但我认为工作元素不可点击。
我会改变Primeng库的p-inputSwitch组件的样式
我会得到这样的东西:
这是我的代码:
<div class="contner">
<div class="toggle-area">
<p>SEARCH BY</p>
<div >
<p class ="toggle-inline">Business group</p>
<div class="toggle-btn toggle-inline">
<p-inputSwitch [(ngModel)]="checked"
onLabel=""
offLabel=""
styleClass="ui-inputswitch"
></p-inputSwitch>
</div>
<p class="toggle-inline">Borrower</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我从删除标签开始,但宽度也发生了变化,我不知道如何增加它
我将在Angular Web应用程序中使用Microsoft Graph API。
首先,我使用msal库进行连接。 当我尝试使用配置文件登录时,出现此错误
我已经按照官方git示例中提到的配置了我的应用
MsalModule.forRoot({
clientID: "Tenant ID",
authority: "https://login.microsoftonline.com/common/",
redirectUri: "http://localhost:4200/",
validateAuthority : true,
popUp: true
}),
Run Code Online (Sandbox Code Playgroud)
身份验证正在进行,我得到了令牌。
然后,当我进入主页时,我再次向Microsoft Graph API发出请求,以使用该令牌获取用户信息。
getProfile() {
let header= new Headers();
let tokenid= sessionStorage.getItem('msal.idtoken');
header.set('Authorization', 'Bearer ' + tokenid)
let url ="https://graph.microsoft.com/v1.0/me/"
return this.http.get(url,{headers:header});
}
Run Code Online (Sandbox Code Playgroud)
}
我收到响应401 Unauthorized错误:
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure.",
"innerError": {
"request-id": "xxxxxx",
"date": "2018-10-09T22:58:41"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道为什么MG API不接受我的令牌,我是否使用了错误的授权URL?
更新:我知道实际上我得到的id_token与访问令牌不同。如何从MSAL库获取Access令牌以进行MS GRAPH API调用?:
javascript azure-active-directory microsoft-graph azure-ad-msal angular
我会将我的普通条形图表转换为与下面的照片完全相同的圆形细条
我看到许多示例建议绘制/扩展新图表,但我不知道如何在 angular 框架内执行此操作,这是一个示例。
这是我的实际图形栏:
const ctx = this.myChart.nativeElement.getContext('2d');
this.myChartBis = new Chart(ctx, {
type: 'bar',
data: {
labels: this.labels,
datasets: [{
label: 'test',
showLine: true,
lineTension: 0,
data: this.data,
fill: false,
pointBorderColor: '#cd0037',
pointBackgroundColor: '#ffffff',
borderColor: [
'#747678',
],
borderWidth: 0
}
],
},
options: {
showLines: true,
legend: {
display: false,
},
responsive: true,
maintainAspectRatio: true,
tooltips: {
yPadding: -2,
xPadding: 10,
footerMarginTop: 5,
titleFontColor: 'rgba(0, 0, 255, 0.0)',
displayColors: false,
borderWidth: 1,
bodyFontSize: 16,
bodyFontFamily: …Run Code Online (Sandbox Code Playgroud) 我有一个包含图标的节点图:
$(go.TextBlock, {
font: '18pt Material Icons', alignment: go.Spot.LeftCenter, stroke: '#FFFFFF',
margin: new go.Margin(0, 5, 0, -34),
},
new go.Binding('text', 'statusIcon')),
Run Code Online (Sandbox Code Playgroud)
我想无限地旋转 statusIcon,但前提是statusIcon匹配一个值。
我已经看过如何添加这样的 css 规则。
font: '18pt Material Icons', alignment: go.Spot.LeftCenter, stroke: '#FFFFFF',
margin: new go.Margin(0, 5, 0, -34),animation:'spin 4s linear infinite';
Run Code Online (Sandbox Code Playgroud)
但我收到一个错误
试图在对象上设置未定义的属性“动画”:TextBlock
我想只有少数 css 规则被 gojs 接受TextBlock。
如何仅向节点子元素添加动画?