Ej DEV
Ej DEV

Reputation: 202

Bootstrap type-ahead and angular-schema-form not working

The filter "liveSearchEmployee()" does not trigger on the parent scope of the controller. It appears to be being ignored.

<input style="width:250px" type="text" ng-model="$$value$$"     ng-change="changeEmployee($$value$$)"    typeahead="(items.lastname + ', ' + items.firstname) for items in liveSearchEmployee($$value$$) "   typeahead-on-select="selectedPatientConsult($item)"    typeahead-min-length="3"   ng-hide="{{form.schema.readOnlyMode}}"    name="{{form.key}}" id="{{form.key}}" title="{{form.title}}"   ng-required="form.required" /> 

Upvotes: 1

Views: 458

Answers (1)

davidlgj
davidlgj

Reputation: 476

With "parent scope of the controller" I guess you mean its on the scope outside of the form?

The directive sf-schema has an isolated scope so nothing outside is inherited.

Try putting what you need onto the form definition object instead for your field type.

<input style="width:250px" type="text" ng-model="$$value$$"     
       ng-change="form.changeEmployee($$value$$)"  
       typeahead="(items.lastname + ', ' + items.firstname) for items in form.liveSearchEmployee($$value$$) "   
       typeahead-on-select="form.selectedPatientConsult($item)"    
       typeahead-min-length="3"   
       ng-hide="{{form.schema.readOnlyMode}}"    
       name="{{form.key}}" id="{{form.key}}" 
       title="{{form.title}}" ng-required="form.required" /> 

Or even better, wrap it in a directive that exports these functions.

Upvotes: 2

Related Questions