我正在学习Typescript,并试图在一段时间内多次打印控制台消息.但在我的测试中,这发生了一次,你知道原因吗?
代码如下:
class Class {
private msg: string;
constructor(msg: string) {
this.msg = msg;
}
private printMsg(): void {
console.log(this.msg);
};
public repeatMsg(): void {
let intervalo = setInterval(this.printMsg(), 2000);
setTimeout(function() {
clearInterval(intervalo);
}, 40000);
}
}
let test: Class;
test = new Class("Hello");
test.repeatMsg();
Run Code Online (Sandbox Code Playgroud) 我在一个组件中有一个对象,我想将它传递给另一个组件。问题是这个其他组件将在新选项卡中打开。
我试图使用数据服务策略,但是当标签打开时,数据服务对象未定义。
我考虑过使用查询参数并传入 url。但是对象很复杂
我的数据服务:
@Injectable({providedIn: 'root'})
export class DataService {
private anime: Anime;
constructor() { }
setAnime(anime: Anime) {
this.anime = anime;
}
getAnime() {
return this.anime;
}
}
Run Code Online (Sandbox Code Playgroud)
在数据服务中设置对象:
goToDetailsByService(anime: Anime) {
this.dataService.setAnime(anime);
//this.router.navigateByUrl('/details');
window.open('/details');
}
Run Code Online (Sandbox Code Playgroud)
通过服务数据获取动漫对象:
ngOnInit(): void {
console.log(this.dataService.getAnime());
this.anime = this.dataService.getAnime()
}
Run Code Online (Sandbox Code Playgroud)
通过导航路由器访问详细信息组件时
我需要帮助来改善图表线上显示的点数。使用当前代码,对于 100000 个点,仅在图形中绘制了 20 个点。
var elements = new Array(100000);
for (i = 0; i < elements.length; i++) {
elements[i] = i;
}
var myChart = echarts.init(document.getElementById('main'));
var option = {
title: {
text: 'ECharts entry example'
},
tooltip: {},
legend: {
data:['Sales']
},
xAxis: {
data: elements
},
yAxis: {},
series: [{
name: 'Sales',
type: 'line',
data: elements
}]
};
myChart.setOption(option);
Run Code Online (Sandbox Code Playgroud)
Guys I'm using flyway on a spring boot project.
When I start the application the migration scripts are executed correctly.
My migrations are in the folder:
flyway.locations = db / migration / postgresql
The problem occurs when I try to execute some purpose of fyway plugin maven from a configuration file.
Configuration File:
flyway.password=root
flyway.schemas=public
flyway.url=jdbc:postgresql://localhost:5432/film
flyway.locations=db/migration/postgresql
Run Code Online (Sandbox Code Playgroud)
Running the maven command:
mvn flyway: repair -Flyway.config File = myFlywayConfig.properties
Returns the error:
Failed to execute goal org.flywaydb:flyway-maven-plugin:6.1.0:repair (default-cli) on project demo-hibernate-envers: …
javascript ×3
angular ×1
charts ×1
echarts ×1
flyway ×1
java ×1
postgresql ×1
routes ×1
setinterval ×1
settimeout ×1
spring ×1
spring-boot ×1
typescript ×1