在我的.angular-cli.json中,我定义了这个:
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/assets/css/main.css",
"styles.css"
],
Run Code Online (Sandbox Code Playgroud)
在我的资产文件夹中,我有(assets/css/*.css)..但是当我运行我的应用程序时,CSS没有加载..我该怎么解决呢?您可以在附件中查看jpeg文件
我定义了一个模型类,我想添加一个枚举标签,如:
export class User {
userID: number;
nom: string;
prenom: string;
dateCretation: Date;
statut: enum {
Value1,
Value2
};
}
Run Code Online (Sandbox Code Playgroud)
枚举中出现标记错误:[ts]预期类型.我该如何解决?
如何定义我的指令以在所有组件中使用它:
我的指示:
import { Parent } from '../../_common/Parent';
declare var jQuery: any;
@Directive({
selector: '[icheck]'
})
export class IcheckDirective implements AfterViewInit {
constructor(private el: ElementRef, private parentCmp: Parent) {
jQuery(this.el.nativeElement).iCheck({
checkboxClass: 'icheckbox_square-aero',
radioClass: 'iradio_square-aero'
}).on('ifChecked', function(event) {
if (jQuery('input').attr('type') === 'radio') {
parentCmp.selectType(jQuery('input[name="filters.type"]:checked').val());
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
我的父母
export abstract class Parent {
}
Run Code Online (Sandbox Code Playgroud)
我的component.ts(使用icheck)
import { Component, OnInit, ViewContainerRef } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Parent } from '../../_common/Parent';
declare var jQuery: any; …Run Code Online (Sandbox Code Playgroud) 我有一个指令,我定义了一个单选按钮,我想调用一个组件的方法..当我在构造函数中注入组件时,我收到了这个错误: ERROR Error: No provider for FoldersComponent!
指令.ts
import { FoldersComponent } from '../folders/folders.component';
import { Directive, ElementRef, HostListener, Input, AfterViewInit, ViewChild, EventEmitter, Output } from '@angular/core';
declare var jQuery: any;
@Directive({
selector: '[icheck]'
})
export class IcheckDirective implements AfterViewInit {
@Output('icheck')
callComponentFunction: EventEmitter<any> = new EventEmitter<any>();
constructor(private el: ElementRef, private parentCmp: FoldersComponent) {
jQuery(this.el.nativeElement).iCheck({
checkboxClass: 'icheckbox_square-aero',
radioClass: 'iradio_square-aero'
}).on('ifChecked', function(event) {
if (jQuery('input').attr('type') === 'radio') {
this.parentCmp.selectType();
}
});
}
ngAfterViewInit(): void {
}
}
Run Code Online (Sandbox Code Playgroud)
文件夹.component.ts
@Component({
selector: 'app-folders', …Run Code Online (Sandbox Code Playgroud) 我有一个带有 FromGroup 和 FormArray 的动态表单。动态表单运行良好,我可以添加新元素等。另一方面,我在表单中默认加载对象列表时遇到问题。例如,如果我有一个包含两个对象的列表,我希望有两个包含其两个对象数据的表单......我在这里有一个关于 stackblitz 的例子:
https://stackblitz.com/edit/angular-4crhvw
PS:在我的示例 stakblitz 中,我制作了显示元素的示例,但我想显示所有元素
将我想发布的内容作为附件查看
我定义了一个指令 iCheck,当我点击单选按钮时,我想调用一个组件中的方法......我的指令:directive.ts
declare var jQuery: any;
@Directive({
selector: '[icheck]'
})
export class IcheckDirective implements AfterViewInit {
constructor(private el: ElementRef) {
jQuery(this.el.nativeElement).iCheck({
checkboxClass: 'icheckbox_square-aero',
radioClass: 'iradio_square-aero'
}).on('ifChecked', function(event) {
if (jQuery('input').attr('type') === 'radio') {
// I want to call my method "selectType() of my component.ts ();
}
})
}
ngAfterViewInit(): void {
return;
}
}
Run Code Online (Sandbox Code Playgroud)
文件夹.component.ts
@Component({
selector: 'app-folders',
templateUrl: './folders.component.html',
styleUrls: ['./folders.component.css']
})
export class FoldersComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private router: Router)
selectType(){ ==> Method …Run Code Online (Sandbox Code Playgroud) 在我执行合并的方法中,JPA为什么不为唯一约束违例引发异常?相反,我在代码中看到了引发异常的地方。
我想获取诸如(Update Error)之类的异常消息,但没有捕获到异常。
我想得到这个回应:
{
"errorMessage": "Update Error",
"errorCode": 404,
"documentation": ""
}
Run Code Online (Sandbox Code Playgroud)
相反,在控制台中出现此错误:
Caused by: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back
.....
...
Caused by: javax.transaction.RollbackException: ARJUNA016053: Could not commit transaction.
.....
.....
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
......
.....
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (DEMAND_TD_CODE) violated
.....
....
Run Code Online (Sandbox Code Playgroud)
这是我进行更新的地方:
@Override
public Demand updateDemand(Demand demand) throws DemandExceptions {
try {
Demand demandToUpdate = entityManager.merge(demand);
} catch (PersistenceException e) {
throw new DemandExceptions("Update Error");
}
return demandToUpdate;
} …Run Code Online (Sandbox Code Playgroud) 我有2个向量元素,如:
vect 1 = [111111 5, 111111 5, 222222 5, 333333 5, 111111 2]
vect 2 = [111111 5, 222222 4, 333333 2, 111111 2, 444444 8, 333333 5, 111111 1, 222222 5]
Run Code Online (Sandbox Code Playgroud)
如何在Java中删除vect 2中存在的向量1的元素?
我想得到这个结果:
vect 2 = [222222 4, 333333 2, 444444 8, 111111 1]
Run Code Online (Sandbox Code Playgroud)
谢谢
angular ×5
java ×2
typescript ×2
assets ×1
css ×1
form-control ×1
formarray ×1
formgroups ×1
hibernate ×1
html ×1
jpa ×1
vector ×1