Angularjs 调用系列中的角度方法-高度图表
我只是一个学习角椅和高脚椅的新手。我的问题是如何调用angular方法来动态地呈现图表。 我引用了此链接,但我不理解其中的任何内容: 链接:。 链接: 请应用我来解决这个问题Angularjs 调用系列中的角度方法-高度图表,angularjs,highcharts,Angularjs,Highcharts,我只是一个学习角椅和高脚椅的新手。我的问题是如何调用angular方法来动态地呈现图表。 我引用了此链接,但我不理解其中的任何内容: 链接:。 链接: 请应用我来解决这个问题 app.component.ts import { Component } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-root', template
app.component.ts
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
name:string = '';
age:number;
found:boolean;
constructor(private httpClient: HttpClient) { }
onNameKeyUp(event:any){
this.name = event.target.value;
this.found = false;
}
getProfile(){
this.httpClient.get(`https://my-json-server.typicode.com/techsithgit/json-faker-directory/profiles/?name=${this.name}`)
.subscribe(
(data:any[] )=>{
if(data.length){
this.age = data[0].age;
this.found = true;
}
}
)
}
}
app.component.html
<input type ="text" (keyup) = "onNameKeyUp($event)">
<button (click)= "getProfile()">Get User Details</button>
<br>
<div *ngIf="found" >
<span>{{name}}'s age is {{age}}</span>
</div>
获取用户详细信息
{{name}的年龄是{{age}
到目前为止,您尝试了什么?给我们看看你的代码!是的,我试过了,如何添加包含URL动态的系列图表组件我不太理解你的问题。请更准确地描述它,并一步一步地向我解释你想要做什么。嗨,daniel_s,我必须以角度读取json数据,并使用highcharts中的序列绘制相同的数据