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

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

Closed
stewones opened this issue Nov 3, 2015 · 15 comments
Closed

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

stewones opened this issue Nov 3, 2015 · 15 comments

Comments

@stewones
Copy link

stewones commented Nov 3, 2015

materialbug

@snarayanank2
Copy link

+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.

@makkart
Copy link

makkart commented Nov 9, 2015

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

@dominicgoulet
Copy link

+1 not working since RC1 for me.

@ThomasBurleson ThomasBurleson modified the milestones: 1.0-rc4, 1.0-rc5 Nov 16, 2015
@nextor2k
Copy link

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!

@dominicgoulet
Copy link

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');
};

@robertmesserle robertmesserle modified the milestones: post-1.0 , 1.0-rc5 Nov 18, 2015
@Tarpsvo
Copy link

Tarpsvo commented Nov 20, 2015

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

Eagerly waiting for a fix.

@nextor2k
Copy link

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.

@Tarpsvo
Copy link

Tarpsvo commented Nov 20, 2015

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

@vitorlopez
Copy link

+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.

@dominicgoulet
Copy link

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

@vitorlopez
Copy link

@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

devversion added a commit to devversion/material that referenced this issue Dec 5, 2015
Currently the Not Found Template will be removed for a few seconds from the DOM, that's why clicks not getting registered.
This can be fixed by checking for the mouse position. The Mouse should be on the list.

Fixes angular#5526
@devversion
Copy link
Member

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

@vitorlopez
Copy link

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

devversion added a commit to devversion/material that referenced this issue Dec 5, 2015
Currently the Not Found Template will be removed for a few seconds from the DOM, that's why clicks not getting registered.
This can be fixed by checking for the mouse position. The Mouse should be on the list.

Fixes angular#5526
devversion added a commit to devversion/material that referenced this issue Dec 6, 2015
Currently the Not Found Template will be removed for a few seconds from the DOM, that's why clicks not getting registered.
This can be fixed by checking for the mouse position. The Mouse should be on the list.

Fixes angular#5526
@ThomasBurleson ThomasBurleson modified the milestones: post-1.0 , Backlog Jan 5, 2016
@ThomasBurleson ThomasBurleson removed this from the post-1.0 milestone Jan 5, 2016
devversion added a commit to devversion/material that referenced this issue Jan 13, 2016
Currently the Not Found Template will be removed for a few seconds from the DOM, that's why clicks not getting registered.
This can be fixed by checking for the mouse position. The Mouse should be on the list.

Fixes angular#5526
@janvandenberg
Copy link
Contributor

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

devversion added a commit to devversion/material that referenced this issue Jan 28, 2016
Currently the Not Found Template will be removed for a few seconds from the DOM, that's why clicks not getting registered.
This can be fixed by checking for the mouse position. The Mouse should be on the list.

Fixes angular#5526
devversion added a commit to devversion/material that referenced this issue Jan 28, 2016
Currently the Not Found Template will be removed for a few seconds from the DOM, that's why clicks not getting registered.
This can be fixed by checking for the mouse position. The Mouse should be on the list.

References angular#5308 Fixes angular#6191 Fixes angular#5526
ThomasBurleson pushed a commit that referenced this issue Feb 1, 2016
Currently the Not Found Template will be removed for a few seconds from the DOM, that's why clicks not getting registered.
This can be fixed by checking for the mouse position. The Mouse should be on the list.

References #5308 Fixes #6191 Fixes #5526

  Closes #6103
ErinCoughlan pushed a commit to ErinCoughlan/material that referenced this issue Feb 9, 2016
Currently the Not Found Template will be removed for a few seconds from the DOM, that's why clicks not getting registered.
This can be fixed by checking for the mouse position. The Mouse should be on the list.

References angular#5308. Fixes angular#6191. Fixes angular#5526. Closes angular#6103
@agarwal-vishal
Copy link

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

@stewones stewones changed the title bug(autocomplete): ng-click no works inside md-not-found bug(autocomplete): ng-click doesn't work inside md-not-found Oct 12, 2018
@Splaktar Splaktar modified the milestones: - Backlog, 1.1.0 Nov 9, 2018
@angular angular locked as resolved and limited conversation to collaborators Nov 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.