サービスを別のディレクトリにあるコンポーネントにインポートしようとしていますが、サービスインポートでcannot find module error
が引き続き発生します。コンポーネントへの角2インポートサービス
ディレクトリ構造:
//コンポーネント
import { Component, OnInit } from '@angular/core';
import { AtmService } from '../services/atm.service';
@Component({
selector: 'app-atm-list',
templateUrl: './atm-list.component.html',
styleUrls: ['./atm-list.component.css']
})
export class AtmListComponent implements OnInit {
atms: Array<any>;
constructor(private atmService: AtmService) { }
ngOnInit() {
this.atmService.getAtms().subscribe{
data => {
this.atms = data;
},
error => console.error(error)
};
}
}
のようにappフォルダからドリルダウンすることができます自動的に:) –