@fme wrote:
(note I'm a rater newbie to Ionic/angular2/typescript)
I wanted to wrap the ion-select/ion-option duo into my own component.
(it works when dropping the ion- prefix and thus just using ordinary HTML elements select and option)
I get an error in the browser console when it's rendered,
maybe my Component decorator is missing the directives.
(so originally my snippet did not contain the import statement and directive metadata
because I don't know what to use as the symbol names)1) is it possible to wrap ion-select/ion-option into a component
2) how are the directives named (ionSelect ?? and ionOption ??)
And what is the file to import?Here's my code snippet:
import { ionSelect (?? is this the right name), ionOption (?? is this the right name) } from '????' @Component({ selector: 'fm-select', template: `<label>{{title}}</label> <ion-select [ngModel]="defaultOption" (change)='onChange($event)'> <ion-option *ngFor="#o of options" [value]=o.key >{{ o.val }}</ion-option> </ion-select> ` directives : [ ionSelect, ionOption] // again here are the names })Here is the console log:
EXCEPTION: No value accessor for '' in [defaultOption in FmSelectCompontent@1:25] EXCEPTION: No value accessor for '' in [defaultOption in FmSelectCompontent@1:25] ORIGINAL EXCEPTION: No value accessor for '' ORIGINAL STACKTRACE: Error: No value accessor for '' at new BaseException (exceptions.ts:9) at _throwError (shared.ts:56) at Object.setUpControl (shared.ts:28) at NgModel.ngOnChanges (ng_model.ts:76) at AbstractChangeDetector.ChangeDetector_FmSelectCompontent_0.detectChangesInRecordsInternal (viewFactory_FmSelectCompontent:92) at AbstractChangeDetector.detectChangesInRecords (abstract_change_detector.ts:136) at AbstractChangeDetector.runDetectChanges (abstract_change_detector.ts:110) at AbstractChangeDetector._detectChangesInViewChildren (abstract_change_detector.ts:237) at AbstractChangeDetector.runDetectChanges (abstract_change_detector.ts:115) at AbstractChangeDetector._detectChangesInViewChildren (abstract_change_detector.ts:237) ERROR CONTEXT: _Context {element: ion-select, componentElement: fm-select, context: FmSelectCompontent, locals: Object, injector: Injector…}componentElement: fm-selectcontext: FmSelectCompontentelement: ion-selectexpression: "defaultOption in FmSelectCompontent@1:25"injector: Injectorlocals: Object__proto__: Object ngOnInit
Posts: 2
Participants: 1