Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.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 使用上一个“在ng中选择”选项中的值_Javascript_Angularjs - Fatal编程技术网

Javascript 使用上一个“在ng中选择”选项中的值

Javascript 使用上一个“在ng中选择”选项中的值,javascript,angularjs,Javascript,Angularjs,我有以下代码: <label class="item item-input item-select" name="coffeehouse"> <span class="input-label">Coffee House</span> <select ng-options="shop.label for shop in products" ng-model="order.coffeehouse"></select> </la

我有以下代码:

<label class="item item-input item-select" name="coffeehouse">
  <span class="input-label">Coffee House</span>
  <select ng-options="shop.label for shop in products" ng-model="order.coffeehouse"></select>
</label>
<label class="item item-input item-select" name="product">
  <span class="input-label">Product</span>
  <select ng-options="product.label for product in //PROBLEM//" ng-model="order.product"></select>
</label>
请注意,它使用工厂,因此您在这里看不到数据源,但它是一个对象数组,如下所示:

[
  { label: 'Store 1', products: [{ label: 'Product 1' }, { label: 'Product 2' }] },
  { label: 'Store 2', products: [{ label: 'Product 1' }, { label: 'Product 2' }] }
]

有什么想法吗?

这里有一种方法:

var myApp=angular.module('myApp',['ionic']);
myApp.controller('DropCtrl',函数($scope,$ionicLoading){
$ionicLoading.show({
模板:“正在加载…”,
动画:“淡入”,
真的,,
放映延迟:10
});
$scope.order={};
$scope.products=[
{label:'Store 1',products:[{label:'Product 1'},{label:'Product 2'}]},
{label:'Store 2',products:[{label:'Product 1'},{label:'Product 2'}]}
];
//模拟加载1.5秒。
setTimeout(函数(){
$ionicLoading.hide();
}, 1500);
});

咖啡馆
产品


您可以发布控制器吗?
[
  { label: 'Store 1', products: [{ label: 'Product 1' }, { label: 'Product 2' }] },
  { label: 'Store 2', products: [{ label: 'Product 1' }, { label: 'Product 2' }] }
]