PeterStaev / NativeScript-Drop-Down

A NativeScript DropDown widget.
Apache License 2.0
105 stars 65 forks source link

Can't find module "nativescript-drop-down" #38

Closed KyawBo closed 8 years ago

KyawBo commented 8 years ago

I have an issue when I call DropDown control from .ts file like this.

import { DropDown } from "nativescript-drop-down";

creambyemute commented 8 years ago

I had the same problem.

Do you really need it or did you just follow the readme and wanted to use "let dd = page.getViewById("dd");"?

I got the same implemented like this: Html <DropDown #dd [items]="calendarListItems" [selectedIndex]="selectedIndex" (selectedIndexChange)="onSelectedIndexChange(dd.selectedIndex)" row="0" colSpan="2"></DropDown>

.ts file public calendarListItems: ValueKeyList; public calendarItems: Array<IValueItem>; declarations (don't forget to initialize them in the constructor like this.calendarItems = []; this.calendarListItems = new ValueKeyList([]);

And I fill those arrays here: Calendar.listCalendars().then( (calendars) => { calendars.forEach((calendar) => { this.calendarItems.push({ValueMember: calendar.id, DisplayMember: calendar.name}); }); if (calendars.length > 0) { this.selectedIndex = 0; } timer.clearInterval(id); this.calendarListItems = new ValueKeyList(this.calendarItems); }, function (error) { console.log("Error while listing Calendars: " + error); } )

PeterStaev commented 8 years ago

Hey @KyawBo , make sure you add a references to node_modules/NativeScript-Drop-Down/drop-down.d.ts to either your references.d.ts file or in the file wherever you import the drop down.