generator-angular2-library icon indicating copy to clipboard operation
generator-angular2-library copied to clipboard

Sample.service.ts not found

Open ShahinShabnam opened this issue 7 years ago • 1 comments

when i m creating object of sampleservice in the constructor of sample-component its giving error in the run time not giving error in compile time saying dat sample-service no found.

Error: Fetch error: 404 Not Found Instantiating http://localhost:3000/custom-keyboard.service Loading http://localhost:3000/dist/demo1.umd.js

ShahinShabnam avatar Oct 10 '17 13:10 ShahinShabnam

working for me: ``import { Component } from '@angular/core'; import { LIST } from './providers/list'; import { MyCustomService } from './providers/custom-service';

@Component({ selector: 'sample-component', template: <h1>Sample component</h1> <ul> <li *ngFor="let myObject of objectArray"> {{myObject.name}} - {{translate(myObject.name)}} </ul>, providers: [ MyCustomService ] }) export class SampleComponent {

public myObjectArray = LIST;

constructor(private myCustomService: MyCustomService) { }

public translate(name) { return this.myCustomService.translate(name); }

}``

ghwrivas avatar May 22 '18 04:05 ghwrivas