Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/452.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJS-设置默认下拉菜单选项时遇到问题_Javascript_Angularjs - Fatal编程技术网

Javascript AngularJS-设置默认下拉菜单选项时遇到问题

Javascript AngularJS-设置默认下拉菜单选项时遇到问题,javascript,angularjs,Javascript,Angularjs,我对AngularJS是新手。目前,我在电子商务网站上应用了以下两个过滤器: <div ng-show="user.ShipMethod != null && shippers && orderShipAddress.AddressName != 'BIG'" " ng-class="{'view-form-select': !currentOrder.LineItems[0].ShipperName, ''

我对AngularJS是新手。目前,我在电子商务网站上应用了以下两个过滤器:

                         <div ng-show="user.ShipMethod != null && shippers && orderShipAddress.AddressName != 'BIG'" " ng-class="{'view-form-select': !currentOrder.LineItems[0].ShipperName, '': currentOrder.LineItems[0].ShipperName }">
                                <label ng-class="{required: !currentOrder.IsMultipleShip() && user.ShipMethod != null}" ng-show="currentOrder.LineItems[0].ShipperName || !currentOrder.IsMultipleShip() && user.ShipMethod != null">{{('Shipping' | r) + ' Method' | xlat}}</label>
                                <select class="form-control" ng-change="updateShipper()" name="shipMethod"
                                        ng-model="currentOrder.LineItems[0].ShipperName"
                                        ng-show="user.ShipMethod.ShipperSelectionType == 'UserDropDown'"
                                        ng-options="shipper.Name as (shipper.Name + ' ' + (shipper.ShippingRate.Price | currency | xlat)) for shipper in shippers | filter: { Name: '!Pick-Up at BIG'}"
                                        ng-required="!currentOrder.IsMultipleShip() && user.ShipMethod != null" >

                                    <option value=""></option>
                                </select>
                                <i class="fa fa-truck"></i>
                            </div>

                            <div ng-show="user.ShipMethod != null && shippers && orderShipAddress.AddressName == 'BIG'" ng-class="{'view-form-select': !currentOrder.LineItems[0].ShipperName, '': currentOrder.LineItems[0].ShipperName }">
                                <label ng-class="{required: !currentOrder.IsMultipleShip() && user.ShipMethod != null}" ng-show="currentOrder.LineItems[0].ShipperName || !currentOrder.IsMultipleShip() && user.ShipMethod != null">{{('Shipping' | r) + ' Method' | xlat}}</label>
                                <select class="form-control" ng-change="updateShipper()" name="shipMethod"
                                        ng-model="currentOrder.LineItems[0].ShipperName"
                                        ng-show="user.ShipMethod.ShipperSelectionType == 'UserDropDown'"
                                        ng-options="shipper.Name as (shipper.Name + ' ' + (shipper.ShippingRate.Price | currency | xlat)) for shipper in shippers | filter: { Name: 'Pick-Up at BIG'}"
                                        ng-required="!currentOrder.IsMultipleShip() && user.ShipMethod != null" >
                                    <option value=""></option>
                                </select>
                                <i class="fa fa-truck"></i>
                            </div>
                        </div>

使用ng模型为列表项设置默认值。无论何时选择一个项目,您设置的ng模型变量都将更新


使用ng模型为列表项设置默认值。无论何时选择一个项目,您设置的ng模型变量都将更新


使用ng模型为列表项设置默认值。无论何时选择一个项目,您设置的ng模型变量都将更新


使用ng模型为列表项设置默认值。无论何时选择一个项目,您设置的ng模型变量都将更新



我不清楚这个问题。是否要为列表项设置默认值?抱歉;是的…列表的默认值。我不清楚这个问题。是否要为列表项设置默认值?抱歉;是的…列表的默认值。我不清楚这个问题。是否要为列表项设置默认值?抱歉;是的…列表的默认值。我不清楚这个问题。是否要为列表项设置默认值?抱歉;是…列表的默认值。
$scope.currentOrder.LineItems[0].ShipperName = $scope.shippers[0];
<select  ng-options="p for p in animal"
            ng-model="selectedanimal"></select>