I'm facing an issue while loading a Nativescript app using Angular 2 and TypeScript. I've been attempting to resolve this for quite some time. Here is a snippet of my code:
list.service.ts
import { ItemListApi } from '../sdk/services/custom/ItemList';
import { ItemList } from '../sdk/models/ItemList';
@Injectable()
export class ListService {
items: Observable<Array<Item>>;
public grocery: Grocery = new Grocery('', '');
private listModel: ItemList = new ItemList();
constructor(private itemListApi: ItemListApi,
private authModelApi: AuthModelApi,
private loginCredentials: LoginCredentials) {
}
addItems(list: ItemList) {
let uid;
uid = this.loginCredentials.getUserId();
return this.itemListApi.create({
"name": list.name,
"userid": uid
});
};
}
module.ts
@NgModule({
imports: [
CommonModule,
FormsModule,
RouterModule
],
declarations: [
LoginComponent,
ListComponent
],
providers: [
LoginService,
ListService,
LoginCredentials,
HeroActions,
HeroService
],
exports: [
LoginComponent,
ListComponent
]
})
Every time I try to run the app, I encounter the error message "No provider for ItemListApi" ... the ItemListApi comes from the Loopback Nativescript SDK. Can someone help me identify the problem with my code?