here's the situation. I've got an angular bootstrap dropdown that displays a list of "organizations" to be selected. It looks like this:
<button type="button" class="btn btn-primary dropdown-toggle" ng-disabled="disabled">
<span class="caret"></span>
</button>
<ul class="dropdown-menu scrollable-menu" role="menu">
<li ng-repeat="org in organizations | orderBy:'Name'"><a href="#" ng-click="pickNewOrg(org)">{{org.Name}}</a></li>
</ul>
I've also got a text input to allow for typing in the organization name, with angular's bootstrap typeahead and a custom validator to make sure the organization typed in is actually in my list of organizations. It looks like this:
<input name="organization"
type="text"
ng-model="activity.org"
typeahead="org as org.Name for org in organizations | filter:$viewValue"
valid-organization/>
Here's the issue: the validation works fine if the text is typed into the input (where the validator's directive is), but the validation isn't called if an object is selected from the dropdown. So, if an incorrect organization is typed in, the validity is set to false, but if an organization is then clicked out of the menu, it remains false, not having been validated. Since anything clicked in the dropdown is valid, I'm wondering how I can re-use my validator on button click? Or perhaps another method would be better?
valid-organizationdirective to the dropdown?