angular - 无法以角度获取价值形式的服务类
问题描述
component.ts 文件
导入 { Component, OnInit, Input } from '@angular/core';
从'../../../../shared/history.service'导入{ HistoryService };
从“@angular/router”导入{路由器};
从'@angular/forms'导入{ NgForm };
从'../../../../shared/history.model'导入{历史};
@Component({
selector: 'app-ins-history',
templateUrl: './ins-history.component.html',
styleUrls: ['./ins-history.component.css'],
providers:[HistoryService]
})
export class InsHistoryComponent implements OnInit {
constructor(public UserProfileService: HistoryService, private router: Router) { }
ngOnInit() {
this.HistoryList();
}
HistoryList()
{ let title = this.UserProfileService.Title;
console.log(title);
this.UserProfileService.getHistoryList(title).subscribe((res)=> {
this.UserProfileService.history= res as History[];
alert('ok');
});
}
}[historyservice.ts][1]
解决方案
推荐阅读
- machine-learning - Multi-Scale CNN
- r - Dimension reduction linear and non linear method need detail explain
- java - Maven Spring Boot Application startup failed - JmxAutoConfiguration.mbeanExporter
- pandas - Write multiple files to excel using pandas &excelwriter
- android - Error 403 Forbidden : Impossible to access to jcenter
- matrix - 计算 GAMS 中的特定矩阵
- javascript - Vue js: difference between build targets lib and web component?
- google-apps-script - 在工作表中制作多个导入范围的数组
- ios - 混合 CALayers 背景颜色
- arrays - 将字符串转换为字节数组,然后写入 bin 文件