bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

[typeahead] isLoading and noResults available in popup scope

Open wen96 opened this issue 9 years ago • 6 comments

Outside directive controller you don't have access to position() values and inside directive you don't have access to isOpen and isNoResults. So, to have a same styled results showing No matches or Loading..., you have to re-implement position() or add fake values if no matches or during loading which could be a little bit ugly with something which is already calculated inside scope.

We can change plugin code to something like:

isLoadingSetter(originalScope, true);
// to
 isLoadingSetter(originalScope, scope.isLoading = true);

And then pass this values to popup template. This feature allows to create custom templates like:

 <ul  ng-show="isOpen() || isLoading || isNoResults" ...>
        <li  ng-repeat="match in matches track by $index" ....>
                <div uib-typeahead-match ...></div>
         </li>
         <li ng-if="isLoading">Is loading</li>
         <li ng-if="isNoResults">No results</li>
</ul>

I can make a PR doing this but I wanted to ask you before. What do you think?

wen96 avatar Apr 29 '16 08:04 wen96

I'm ok with this if done correctly, but you cannot use ES6 syntax like you've done as we do not yet support that in our builds. @wesleycho, thoughts?

A potential PR will need associated tests and may need doc updates as well.

icfantv avatar Apr 29 '16 15:04 icfantv

Hi All, I want to use Typeahead functionality to get ajax call on time interval but I do not want to show list of items's pop up. How can I prevent to show that popup?

piyush-avantsoft avatar May 05 '16 07:05 piyush-avantsoft

Please don't spam questions irrelevant to the original issue in that issue.

wesleycho avatar May 05 '16 12:05 wesleycho

So as for this feature, I'm ok with it, but it needs to reset isLoading to false after it finishes the load.

PRs welcome.

wesleycho avatar Jun 03 '16 20:06 wesleycho

OK guys, thank you. I'll PR ASAP.

wen96 avatar Jun 06 '16 08:06 wen96

Hi.

There is any way to pass isLoading and noResults in a popup template scope now ? Or do you still need a PR ?

Untel avatar Nov 06 '17 17:11 Untel