-
Notifications
You must be signed in to change notification settings - Fork 3.4k
md-select error on name attribute #3062
Comments
I am having the same issue. I am defining the name of an mdSelect directive using the following code:
I am getting: TypeError: Cannot read property '$name' of undefined FYI: This is part of an ng-repeat loop. |
Any word on this? For someone that cannot hack angular-material.js, this is a serious issue... |
Same issue here (version1.4.0) even when I don't set it programatically, I can just leave it without 'name' for now but then I get no validation.
I don't think there is anything wrong with my code. |
Have same problem, +1 it happens here: if (attr.name && formCtrl) {
var selectEl = element.parent()[0].querySelector('select[name=".' + attr.name + '"]')
formCtrl.$removeControl(angular.element(selectEl).controller()); // <--- controller() returns undefined
} aa440ef#diff-d7b463f733c2e3fbc783f38073561b74R153 Intention is unclear to me. If I step through the code in debugger, hidden select element is not part of the form anyway. If I comment this block, then it works for me. I didn't tried $timeout solution suggested by @hodeyp (can you provide the code pls?). It has to resolve #1801 somehow, but I do not use it so cannot test. |
+1 have the same issue. |
+1 I found a workaround: which uses outer form + inner form for each ng-repeat item |
+1 same issue, hope this one get fixed soon. |
+1 |
This appears to be caused by lack of a controller around the directive. http://codepen.io/karlhorky/pen/OVZOqy I've opened a PR: #3671 |
I need to define the name on an md-select programatically using {{id}}. However, when doing so an error is thrown...
TypeError: Cannot read property '$name' of undefined
the offending code is on line 8029 of angular-material.js...
it looks to be a timing issue of when the attr.name is bound, as a hack I put the function into a $timeout and it worked correctly.
The text was updated successfully, but these errors were encountered: