I wonder if anyone could help me i have created a new directive so i can filter a dropdown list while loading data from a webServer. It all works fine, and i can write the values to the html page using {{ myValue }}, and i can even use ng-model on an input, and it returns the value.
But for some reason, if i try to access the variable ($scope.myValue) via the controller, it says it undefined?
I have created a plunker (doesnt load data from webServer, but just loads basic list values instead), but this seems to work, and my project doesnt, which i dont get as i have copied it from my project!! arhhhh.
If anyone has any ideas, i would really appreicate hearing them.
Plunker http://plnkr.co/edit/c7g2vOQwvWH07I9FYhDB?p=preview
On my page i have
<div search-dropdown text="myText" value="myValue"></div>
The directive is
<div class="btn-group searchDropdown">
<button type="button" class="btn btn-default">
<input search-dropdown-input type="text" placeholder="Enter name to search..." ng-model="filterText" ng-change="filter();" />
</button>
<button search-dropdown-toggle type="button" class="btn btn-default dropdown-toggle">
<span class="caret"></span>
<span class="sr-only">Split button!</span>
</button>
<ul class="dropdown-menu" role="menu">
<li ng-repeat="item in items"><a href="javascript:void(0);" ng-click="selectItem($index);">{{ item.name }}</a></li>
</ul>
</div>