单击 angular js 中的按钮添加新文本框 [英] Add new text box on click of a button in angular js
问题描述
如何在按下提交按钮时添加新的文本框.这是我尝试过的,我知道有些问题.我还是 angular js 的新手.
示例:
<html lang="zh-cn"><头><meta charset="UTF-8"><title>示例 - example-ngController-production</title><script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script><脚本>angular.module('controllerAsExample', []).controller('SettingsController1', function ($scope) {$scope.contacts=[]$scope.addContact = function(){$scope.contact.push({$scope.contact})}});};头部><body ng-app="controllerAsExample"><div id="ctrl-as-exmpl" ng-controller="SettingsController1"><ul><li ng-repeat="联系人中的联系人"><input type="text" ng-model="contact"/><li><button ng-submit="addContact()">add</button></li>