Skip to content

(autocomplete) _onChange is not a function #2947

Closed
@axtho

Description

@axtho

Bug:

Implementing the nightly builds creates an error (since the last major update by kara) in the underlying trigger class:

TypeError: this._onChange is not a function
    at MdAutocompleteTrigger._handleInput (autocomplete-trigger.js:166)
    at Wrapper_MdAutocompleteTrigger.handleEvent (wrapper.ngfactory.js:68)
    at View_SearchBoxComponent3.handleEvent_2 (component.ngfactory.js:266)
    at View_SearchBoxComponent3.<anonymous> (view.js:664)
    at HTMLInputElement.<anonymous> (dom_renderer.js:490)
    at ZoneDelegate.webpackJsonp.546.ZoneDelegate.invokeTask (zone.js:275)
    at Object.onInvokeTask (ng_zone.js:262)
    at ZoneDelegate.webpackJsonp.546.ZoneDelegate.invokeTask (zone.js:274)
    at Zone.webpackJsonp.546.Zone.runTask (zone.js:151)
    at HTMLInputElement.ZoneTask.invoke (zone.js:345)

What is the expected behavior?

Entering a string in the input field should open the autocomplete panel.

What is the current behavior?

Nothing happens. Error occurs in the JS logs.

What are the steps to reproduce?

This issue appeared even when using the example given here (https://github.com/angular/material2/tree/master/src/demo-app/autocomplete).

Here is my setup:

<md-input-container flex>
        <input mdInput
               placeholder="Search..."
               type="search"
               [mdAutocomplete]="auto"
               (blur)="handleBlur()"
               (search)="handleSearch($event)"
               (keyup)="handleSearch($event)"
               (clear)="toggleVisibility()"
               style="width:100%">
    </md-input-container>
    <md-autocomplete #auto="mdAutocomplete">
        <md-list>
            <md-list-item *ngFor="let item of items"
                          [routerLink]="['/person/view', item.id]"
                          class="item" style="cursor: pointer">
                <img md-list-avatar src="{{item.icon}}" alt="..." class="img"
                     style="max-width: 40px;max-height:40px">
                <span class="text" md-line>{{ item.text }}</span>
            </md-list-item>
        </md-list>
    </md-autocomplete>

What is the use-case or motivation for changing an existing behavior?

Use case: implementing a top search-bar

Which versions of Angular, Material, OS, browsers are affected?

@angular/cli: 1.0.0-beta.30
node: 6.9.2
os: darwin x64
@angular/common: 2.4.6
@angular/compiler: 2.4.6
@angular/core: 2.4.6
@angular/flex-layout: 2.0.0-beta.4
@angular/forms: 2.4.6
@angular/http: 2.4.6
@angular/material: 2.0.0-beta.1 ("@angular/material": "https://github.com/angular/material2-builds.git")
@angular/platform-browser: 2.4.6
@angular/platform-browser-dynamic: 2.4.6
@angular/router: 3.4.6
@angular/cli: 1.0.0-beta.30
@angular/compiler-cli: 2.4.6
@angular/platform-server: 2.4.6

TypeScript is at: 2.0.10
Build uses ng serve (ng serve --proxy-config proxy.conf.json)

Is there anything else we should know?

I realize that this is the snapshot of current development (not even in a release yet). But maybe this helps to tighten the component for certain environments.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions