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

Error when select (click or enter) option on MdAutocomplete #9094

Closed
pablorsk opened this issue Jul 21, 2016 · 6 comments
Closed

Error when select (click or enter) option on MdAutocomplete #9094

pablorsk opened this issue Jul 21, 2016 · 6 comments
Assignees
Labels
needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue
Milestone

Comments

@pablorsk
Copy link

angular.js:13708 TypeError: Cannot read property 'focus' of undefined
    at MdAutocompleteCtrl.onMouseup [as mouseUp] (angular-material.js:24008)
    at fn (eval at compile (angular.js:14605), <anonymous>:4:313)
    at expensiveCheckFn (angular.js:15694)
    at callback (angular.js:25622)
    at Scope.$eval (angular.js:17444)
    at Scope.$apply (angular.js:17544)
    at Scope.scopePrototype.$apply (hint.js:1427)
    at HTMLElement.<anonymous> (angular.js:25627)
    at HTMLElement.dispatch (jquery.js:4737)
    at HTMLElement.elemData.handle (jquery.js:4549)(anonymous function) @ angular.js:13708(anonymous function) @ angular.js:10347$apply @ angular.js:17549scopePrototype.$apply @ hint.js:1427(anonymous function) @ angular.js:25627dispatch @ jquery.js:4737elemData.handle @ jquery.js:4549
angular.js:13708 TypeError: Cannot read property '$setViewValue' of undefined
    at angular-material.js:24334
    at processQueue (angular.js:16170)
    at angular.js:16186
    at Scope.$eval (angular.js:17444)
    at Scope.$digest (angular.js:17257)
    at Scope.scopePrototype.$digest (hint.js:1364)
    at angular.js:17483
    at completeOutstandingRequest (angular.js:5955)
    at angular.js:6234

Actual Behavior:

  • What is the issue? *
  • What is the expected behavior?

Angular Versions: *

  • Angular Version: 1.7.5
  • Angular Material Version: 1.1.0-rc.5

Additional Information:

  • Browser Type: * Chrome
  • Browser Version: * 51
  • OS: * Ubuntu
  • Stack Traces:

When I use ENTER, only sencond error appear.

Maybe is related with #8111

@devversion
Copy link
Member

Please share some code and probably a demo?

@devversion devversion added the needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue label Jul 21, 2016
@devversion devversion self-assigned this Jul 21, 2016
@ThomasBurleson ThomasBurleson modified the milestone: 1.1.1 Jul 27, 2016
@devversion
Copy link
Member

I cannot reproduce that issue, since the input element should be always available on mouseUp.
I will close that issue for now, once a demo is provided, we could reopen that issue.

@pablorsk
Copy link
Author

pablorsk commented Aug 19, 2016

Thanks @devversion.

I detect the problem: md-floating-label can't be empty.

When you put something like this:

<md-autocomplete
    md-floating-label=""
></md-autocomplete>

You receive previus error.

If you don't detect the problem, can you provide me a codepen.io base example for md-autocomplete?

@devversion
Copy link
Member

Hey @pablorsk - Thanks for your response.

I was not able to detect any errors, while setting md-floating-label to an empty string.

Here is a codepen demo (with some simple formatting):

http://codepen.io/DevVersion/pen/OXGxEX?editors=1001

@debasispanda
Copy link

@devversion @pablorsk

Able to reproduce the error when setting floating label with timeout. Please find the plunker.

Getting the error 1 and 2 when selecting option from dropdown and error 3 when clearing the selected option on clicking the cross icon in input.

Error: 1

TypeError: Cannot read property 'focus' of undefined
    at e.I [as mouseUp] (VM5725 angular-material.min.js:13)
    at fn (eval at compile (VM5721 angular.min.js:233), <anonymous>:4:313)
    at b (VM5721 angular.min.js:126)
    at e (VM5721 angular.min.js:276)
    at m.$eval (VM5721 angular.min.js:145)
    at m.$apply (VM5721 angular.min.js:146)
    at HTMLElement.<anonymous> (VM5721 angular.min.js:276)
    at Sf (VM5721 angular.min.js:37)
    at HTMLElement.d (VM5721 angular.min.js:37)

Error: 2

TypeError: Cannot read property '$setViewValue' of undefined
    at VM5725 angular-material.min.js:13
    at VM5721 angular.min.js:131
    at m.$eval (VM5721 angular.min.js:145)
    at m.$digest (VM5721 angular.min.js:142)
    at VM5721 angular.min.js:145
    at e (VM5721 angular.min.js:45)
    at VM5721 angular.min.js:48

Error: 3

TypeError: Cannot read property 'dispatchEvent' of undefined
    at le (VM5725 angular-material.min.js:13)
    at e.se [as clear] (VM5725 angular-material.min.js:13)
    at fn (eval at compile (VM5721 angular.min.js:233), <anonymous>:4:415)
    at b (VM5721 angular.min.js:126)
    at e (VM5721 angular.min.js:276)
    at b.$eval (VM5721 angular.min.js:145)
    at b.$apply (VM5721 angular.min.js:146)
    at HTMLButtonElement.<anonymous> (VM5721 angular.min.js:276)
    at Sf (VM5721 angular.min.js:37)
    at HTMLButtonElement.d (VM5721 angular.min.js:37)

@danielyule
Copy link

I have an identical error. It isn't the timeout function, it's binding md-floating-label to a controller property.

In other words, if md-floating-label is a bound property, then you will get the errors that @debasispanda is seeing above. The plunker demonstrates this even without the timeout.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: demo A CodePen demo or GitHub repository is needed to demonstrate the reproduction of the issue
Projects
None yet
Development

No branches or pull requests

5 participants