无法获取价值形式的角度服务类

时间:2019-05-10 11:16:20

标签: angular

component.ts文件
    从'@ angular / core'导入{Component,OnInit,Input};
    从'../../../../shared/history.service'导入{HistoryService};
    从“ @ angular / router”导入{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]

https://i.stack.imgur.com/sRRke.png

0 个答案:

没有答案