material icon indicating copy to clipboard operation
material copied to clipboard

bug(autocomplete): ng-click doesn't work inside md-not-found

Open stewones opened this issue 11 years ago • 15 comments

materialbug

stewones avatar Nov 03 '15 22:11 stewones

+1 I'm running into this as well with version 0.11.4.

         <md-not-found>
            "{{searchCategoryTxt}}" not found.
            <a ng-href="#" ng-click="newCategory(searchCategoryTxt)">Add!</a>
          </md-not-found>

My controller function never gets called. As @stewones mentions, even the demo one doesn't work - it doesn't show the alert.

snarayanank2 avatar Nov 06 '15 06:11 snarayanank2

+1 has been working in RC-1 and maybe RC-2, not working in RC-3

makkart avatar Nov 09 '15 09:11 makkart

+1 not working since RC1 for me.

dominicgoulet avatar Nov 10 '15 18:11 dominicgoulet

as workout: self.$mdAutocompleteCtrl.mouseUp = function(){ $timeout(function(){ inputElement.focus(); }); };

its not good, but for those who need make it to work at any cost!

nextor2k avatar Nov 17 '15 02:11 nextor2k

My current fix is the following:

<md-autocomplete md-search-text-change="searchTextChange(searchText)" ...>
  <md-not-found>
    <span ng-click="ok()">Click here to create new item</span>
  </md-not-found>
</md-autocomplete>

$scope.ok = function() {
  document.querySelector('md-virtual-repeat-container').classList.add('ng-hide');
};

$scope.searchTextChange = function() {
  document.querySelector('md-virtual-repeat-container').classList.remove('ng-hide');
};

dominicgoulet avatar Nov 17 '15 14:11 dominicgoulet

@dominicgoulet @nestorneto I had to combine both of your solutions to get the hack working. Thanks guys.

Eagerly waiting for a fix.

Tarpsvo avatar Nov 20 '15 23:11 Tarpsvo

Just override the mouseUp funcion of $mdAutocompleteCtrl. This worked for me. In my case I have a custom directive that uses the autocomplete component. So its easer for me to do that.

nextor2k avatar Nov 20 '15 23:11 nextor2k

@nestorneto How did you go about hiding the list? I tried it in a few different ways, but only dominicgoulet's hack worked.

Tarpsvo avatar Nov 20 '15 23:11 Tarpsvo

+1 @nestorneto and @dominicgoulet I tried your solution, but isn`t working for me. Could you provide an working example of your implementation? I really need this feature working in 1.0.

vitorlopez avatar Nov 30 '15 20:11 vitorlopez

What's your problem with the current workaround @vlopez5 ?

dominicgoulet avatar Nov 30 '15 21:11 dominicgoulet

@dominicgoulet I tried to do like your demo and still not possible click inside md-not-found. Also I can`t figure out where to put @nestorneto solution.

I am using RC5

vitorlopez avatar Nov 30 '15 21:11 vitorlopez

Finally, there is a fix for that issue. #6103

devversion avatar Dec 05 '15 21:12 devversion

Thank you @DevVersion ! I hope it gets merged soon...

vitorlopez avatar Dec 05 '15 21:12 vitorlopez

Another workaround that worked for me is to change ng-click with ng-mousedown

janvandenberg avatar Jan 17 '16 11:01 janvandenberg

My current fix is the following:

<md-autocomplete md-search-text-change="searchTextChange(searchText)" ...>
  <md-not-found>
    <span ng-click="ok()">Click here to create new item</span>
  </md-not-found>
</md-autocomplete>

$scope.ok = function() {
  document.querySelector('md-virtual-repeat-container').classList.add('ng-hide');
};

$scope.searchTextChange = function() {
  document.querySelector('md-virtual-repeat-container').classList.remove('ng-hide');
};

Thank You

agarwal-vishal avatar Oct 12 '18 07:10 agarwal-vishal