lordfriend / nya-bootstrap-select

An AngularJS select replacement which build select like dropdown component with collection and ng-model support
http://nya.io/nya-bootstrap-select/
MIT License
178 stars 81 forks source link

Reset selected value #127

Closed stefensuhat closed 8 years ago

stefensuhat commented 8 years ago

Hi, I tried to reset the selected value like this:

 <ol class="nya-bs-select show-menu-arrow btn-white" ng-model="user"
    data-live-search="true" data-size="6" data-title="Choose Users">
    <li nya-bs-option="value in users" data-value="value.id">
        <a>{{value.name}}</a>
    </li>
</ol>

Controller:

$scope.users = ['and', 'bcde', 'fgh'];
$scope.reset = () => {
    $scope.user = {};
};

But the selected value cannot be reset. Is there any proper way to reset the value back to default (title)?

lordfriend commented 8 years ago

reset $scope.user to null or undefined

stefensuhat commented 8 years ago

@lordfriend works perfect thanks