动态下拉菜单不工作的提交角度JS [英] Dynamic dropdown not working on submit in angular js
本文介绍了动态下拉菜单不工作的提交角度JS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
添加一个组合框或点击提交工作不删除组合框。我打电话范围功能被点击时提交。
Adding a combobox or deleting a combobox on clicking submit isn't working. I am calling a function in scope when submit is clicked.
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Text Box</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<script>
angular.module('controllerAsExample', []).controller('SettingsController1', function ($scope)
{
$scope.comboBox = []
$scope.addDropDown = function ()
{
$scope.comboBox.push('');
}
$scope.deleteDropDown = function (index)
{
$scope.comboBox.splice(index, 1);
}
});
</script>
</head>
<body ng-app="controllerAsExample">
<div id="ctrl-as-exmpl" ng-controller="SettingsController1">
<input type="text" ng-repeat="dropDown in comboBox track by $index" />
<select ng-model="newValue" ng-options="n in n[]"></select>
<input type="submit" ng-submit="addDropDown()" value="Add" />
<input type="submit" ng-submit="deleteDropDown()" value="Delete" />
</div>
</body>
推荐答案
您应该从更改NG-提交
到 NG-点击
。
这篇关于动态下拉菜单不工作的提交角度JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文