Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

select: md-select-header input not usable, md-select keydown listener overrides search function #9321

@christrude

Description

@christrude

The demo shows to inject $element into the controller and add the following line to your controller:

$element.find('input').on('keydown', function(ev) {
    ev.stopPropagation();
});

However, it is not allowed to inject the $element into a controller, and is improper to do so, and it throws this error:

Error: [$injector:unpr] Unknown provider: $elementProvider <- $element <- SandboxCtrl

All places I've attempted this are within an md-dialog. Without being able to get the md-select keypress listener turned off, I can't get search for select working. Is there some other workaround for this? I cannot get the demo to work on my app, but on codepen it appears to work OK.

Here's my implementation (HTML):

<md-input-container>
    <label>Select or specify {{provision.provisionDestination.destinationType}} connection</label>
    <md-select id="destinationConnections" name="destinationConnections" required ng-model="sandboxConnection" ng-disabled="provision.provisionDestination.destinationType == '' || isViewMode" md-on-open="loadDestinationByType();" md-on-close="setDest(sandboxConnection)" data-md-container-class="selectSelectHeader">
          <md-select-header class="select-header">
               <input ng-model="destSearchTerm"
                       type="search"
                       placeholder="Pick an Existing Destination"
                       class="select-header-searchbox _md-text">
         </md-select-header>
         <md-optgroup label="Existing Destinations">
             <md-option class="destination-connection-option new-connection" ng-value="'0'" ng-click="loadDestinationFieldValues('0')">Specify a Connection</md-option>
             <md-option class="destination-connection-option" ng-repeat="extDest in existingDestination | toArray:false | filter:destSearchTerm" ng-value=" extDest.destinationTitle" ng-click="loadDestinationFieldValues(extDest)">
                               {{extDest.destinationTitle}}
            </md-option>
        </md-optgroup>
    </md-select>
</md-input-container>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions