Set default value to full

I am using angucomplete-alt to view a dropdown. It works great. But in one case, I want to set its value from the controller. I tried

 $scope.selectedCustomer.title = $scope.customerList[1].businessName

& also

$scope.selectedMerchant = $scope.merchantList[1]

But both did not work. The angucomplete-alt documentation says that there is two-way binding. Can someone help me in displaying the default selection.

+4
source share
3 answers

Not sure if you ever found the answer to this question, but I thought I would share how I achieved it.

<angucomplete-alt id="owner"
placeholder="user@example.com"
pause="400"
selected-object="subscription.EmailAddress"
initial-value="{{subscription.EmailAddress}}"

The original value takes a string value using the angular syntax that I was able to create from the controller using curly braces.

Hope this helps.

+7
source

angucomplete-alt ui-bootstrap modal , :

$timeout(function(){
    $scope.$broadcast('angucomplete-alt:changeInput', 'myType', myTypeVal);
}, 200);

.. html

<angucomplete-alt id="myType" placeholder="My Type"
                    pause="400" selected-object="myTypeSelectedFn"
                    remote-url="/searchMyType"
                    remote-url-request-formatter="searchMyTypeFn"
                    search-fields="name" title-field="code"
                    input-class="form-control form-control-small"
                    match-class="angucomplete-highlight"
                    name="myType" minlength="1" field-required="true"
                    field-required-class="alert-danger"
                    text-searching="Fetching.." auto-match="true" 
                    ng-model="modifiedMy.type"/>
+5

, angucomplete-alt. JS angucomplete-alt.

clear-selected = "true" , angucomplete-alt, - 200 :

Clear-selected = "true" , .

document.getElementById('ex1_value'). value = 'customValFromController';

, - , .

:).

0

All Articles