angularJsのドロップダウン値を選択してサービスに保存しようとしています。これを別のビューで使用して、選択した値と完全なドロップダウンを表示できます。私はコントローラ内で選択された値を記録しようとしています。私は未定義の値を取得しています。進む方法を教えてください。角度Jsドロップダウンコントローラ内で未定義の選択値
<td>
<select name="systems" class="pulldown1" id="systems" ng-model="system.selectedOption" ng-controller="EurexController" required ng-options="option.name for option in system.availableOptions track by option.id" ng-init="system.selectedOption=system.availableOptions[0]" ng-change="changed()"> </select>
</td>
コントローラーコード:
$scope.system = {
availableOptions: [{
id: 'Domestic 1',
name: 'Domestic 1'
}, {
id: 'Domestic 2',
name: 'Domestic 2'
}, {
id: 'Global',
name: 'Global'
}, {
id: 'Far East',
name: 'Far East'
}],
// selectedOption: {id: 'Domestic 1', name: 'Domestic 1'} //This sets the default value of the select in the ui
};
私はまた、AngularJS website.Butで言及selectedoptionはまだそれを行うcouldntの使用してみました。
console.log($scope.system.selectedOption);
console.log(systems);
これは有効な質問だと私は私の答えを得ました。誰かがなぜこれを否定したと言えるでしょうか? – Praveen