material icon indicating copy to clipboard operation
material copied to clipboard

md-autocomplete, ui-sref on searched item

Open lillylykho opened this issue 11 years ago • 4 comments

Hello everyone. I use md-autocomplete And I need to add ui-sref( or ng-click) for searched list items. This is example of my HTML, where I added ui-sref to span, but it's not working properly, because it fires only if I click on the text of span:

<md-autocomplete placeholder="{{:: 'SEARCH_INPUT' | translate}}"
                               md-selected-item="selectedItem"
                               md-search-text="searchString"
                               md-items="item in getMatches()" 
                               md-item-text="item.display"
                               md-delay="500">                              
       <span md-highlight-text="searchString" 
                  ui-sref="item.details({itemCode: selectedItem.code">
             {{item.display}}
       </span>
</md-autocomplete>

But how I need to add an ui-sref, that it should fire when I click on whole line?

autocomplete

Thanks!

lillylykho avatar Mar 23 '15 15:03 lillylykho

@lillylykho I think what you're asking for is a different component entirely. An autocomplete form input and dropdown menu full of links are two different patterns. @robertmesserle @rschmukler I think we talked about adding autocomplete support to mdSelect a bit yesterday, or what the difference between mdAutocomplete and mdSelect should be. This should be part of that conversation.

Regardless, a select/dropdown full of links instead of options will require different semantics for accessibility. Basically, a dropdown can either act like a forum input, or a list of links, but not both at the same time.

marcysutton avatar Mar 24 '15 20:03 marcysutton

@lillylykho Is there any reason that you wouldn't do this through md-selected-item-change? I don't think that we would want to support ui-sref in the autocomplete dropdown; however, it could be valid to perform some operation when an item is selected (ie. clicked on)

robertmesserle avatar Apr 01 '15 21:04 robertmesserle

@robertmesserle Thanks!

And yeah, I have already used. It work perfect!

But I should be able to have the option "Open link in new tab" by right-clicking on item. Maybe you can help me with ideas?

Thanks

lillylykho avatar Apr 05 '15 04:04 lillylykho

@lillylykho can you share how you managed to do this ? i am very new to Mean Stack and i tried a similar approach, but no luck ! Only the item.name is a link. Here is what I am trying to do. <md-item-template> <a md-highlight-text="ctrl.searchText" ui-sref="topics.view({topicId: item._id})">{{item.name}}</a> </md-item-template>

Thanks

elwiderman avatar Mar 07 '17 14:03 elwiderman