繁体   English   中英

如何在Angular-UI模式内将ng-repeat与Div一起使用

[英]How do I use a ng-repeat with a Div inside a Angular-UI modal

我在Angular Modal中有一个表单。 我正在与客户员工一起添加新客户。 默认显示为1名雇员,因此我添加了一个按钮,该按钮提供了添加另一名雇员的选项。 我以为添加ng-repeat可以解决问题,但不起作用。 它不会加载ng-repeat所在的Div。plunker

 <div class="col-xs-12" style="width:initial" ng-repeat="employee in addMoreEmployees">
    <div class="inline-fields" style="">
        <label style="">First Name:</label>
        <input style="width:150px" ng-model="selectedCustomerEmployee.CustomerEmployeeFirstName" type="text">
        <label style="margin-left:55px">Phone:</label>
        <input class="spacing-inputs" style="width:150px" ng-model="selectedCustomerEmployee.CustomerEmployeePhoneNumber" type="text">
    </div>
    <div class="inline-fields" style="">
        <label style="margin-left:3px">Last Name:</label>
        <input style="width:150px" ng-model="selectedCustomerEmployee.CustomerEmployeeLastName" type="text">
        <label style="margin-left:71px">Cell:</label>
        <input class="spacing-inputs" style="width:150px" ng-model="selectedCustomerEmployee.CustomerEmployeeCellNumber" type="text">
    </div>
    <div class="inline-fields" style="">
        <label style="margin-left:37px">Email:</label>
        <input style="width:150px" ng-model="selectedCustomerEmployee.CustomerEmployeeEmail" type="text">
        <label style="margin-left:72px">Fax:</label>
        <input class="spacing-inputs" style="width:150px" ng-model="selectedCustomerEmployee.CustomerEmployeeFaxNumber" type="text">
    </div>

    <div class="inline-fields" style="">
        <label style="margin-left:45px">Title:</label>
        <select style="width:150px;height:27px" ng-model="selectedCustomerEmployee.CustomerEmployeeRole">
            <option value="" selected="selected">Select</option>
            <option value="Admin">Admin</option>
            <option value="PM">PM</option>
            <option value="Accountant">Accountant</option>
            <option value="Superintendent">Superintendent</option>
        </select>
    </div><br />
    <input type="button" ng-click="addMoreEmployees.push({id: addMoreEmployees.length + 1})" value=" Add Another Employee">
</div>

PIC

它确实可以工作,但是由于列表最初是空的,因此您看不到任何内容(包括“添加员工”按钮)。 将其添加到example.js中的第30行,您将看到它正确显示:

$scope.addMoreEmployees = [{}];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM