خرید بک لینک

Vote count: 0

Please see my plunkr here

https://plnkr.co/edit/QRQQmxf3ZDyh6o0CqtrD?p=preview

I have a from with a dropdown list that gets populated as shown below:

<form name="frmAccount" role="form" ng-submit="submit()">

    <div class="row">
                        <div class="col-md-6 col-md-offset-3">
                            <div class="form-group">
                                <label for="defaultProvider">My Default Provider</label>
                                <select class="form-control"  ng-model="frmData.defaultProvider">
                                    <option ng-selected="{{row.Selected}}" ng-repeat="row in providerlist" value="{{row}}" name="defaultProvider" >{{row.Text}} </option>
                                </select>
                            </div>
                        </div>
                    </div>

    <div class="col-md-6 col-md-offset-3">
        <button class="btn btn-group-lg btn-primary pull-right" type="submit" >Submit</button>
    </div>
    </form>

in my controller i have a submit function as shown below:

 $scope.submit= function(){
    $scope.selectedValue = $scope.frmData.defaultProvider;
  }

When I click the submit button after selecting a different value in the dropdown list, I am able to see the selectedvalue, but if I don't select a different value, the ng-model="frmData.defaultProvider" is not getting the initial value.

How can i get "frmData.defaultProvider" to bind with the default value when the page was loaded?

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 27 فروردين 1395 ساعت: 13:51

صفحه بندی