Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

bug(typeahead) inside modal #972

Closed
axlekb opened this issue Sep 9, 2013 · 5 comments
Closed

bug(typeahead) inside modal #972

axlekb opened this issue Sep 9, 2013 · 5 comments

Comments

@axlekb
Copy link

axlekb commented Sep 9, 2013

0.6.0 and 1.2.0.rc2

I had this working with 0.4.0, there were some other issues preventing it from working with 0.5.0, but haven't been able to figure it out on the latest code. Am I missing something?

There are two issues:

  1. Why isn't the typeahead ng-model value in the modal getting returned to the ModalDemoCtrl from the ModalInstanceCtrl?
  2. In the previous version, the value shown in the typeahead input after selection would have been the label, not the select (i.e. "Joe" instead of 1)

Here's the Plunkr

@AGiorgetti
Copy link

The new $modal templates uses transclusion to add the modal content to the dialog. Looking at the transclusion documentation and some stackoverflow answers to related questions you should be able to have your two way binding work using something like: 'ngModel="$parent.yourproperty"'.

@AGiorgetti
Copy link

Have a look at #969 and the mods I made to the Modal module, they solved all these kinds of problems for me.

@pkozlowski-opensource
Copy link
Member

Yes, this is essentially the same issue as #969 so let's move the discussion in there. I can see how this can be confusing so we need to improve. For now the best option is to assure that there is "dot" in the ngModel expression:
http://plnkr.co/edit/fBbEqEMj4VELzkJH0olw?p=preview

@AGiorgetti using $parent is not really advisable in this case as it might easily break as soon as you insert any scope-creating directive (ngIf, ngSwitch, ngInclude etc.).

@axlekb
Copy link
Author

axlekb commented Sep 10, 2013

Sorry, I'm not sure I got the answer to part 2 of my question: I was under the impression (from ng-ui-b 0.4.0 and ng 1.1.5) that typeahead="u.id as u.name for u in items" would always display the name, but bind the id. After selection, the id is displayed rather than the name.

@axlekb
Copy link
Author

axlekb commented Sep 10, 2013

This can stay closed, and I'll follow 981 which someone else opened.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants