[英]AngularJS, add row in table from bootstrap modal
I have made a table that pulls the content from my app.js, I made a bootstrap modal where you can put your information in so that it will show up on the table. 我制作了一个表格,从app.js中提取内容,制作了一个引导模式,您可以在其中放入您的信息,以便将其显示在表格上。
The problem is, it's not doing anything, and I can't see where my problem is. 问题是,它什么也没做,而且我看不出问题出在哪里。
HTML where the information goes in: 信息输入的HTML:
<!-- Email -->
<div class="col-md-6">
<input ng-model="newUser.email" type="email" placeholder="E-Mail" required="">
</div>
<!-- Name -->
<div class="col-md-6">
<input ng-model="newUser.name" type="text" placeholder="Name" required="">
</div>
And this is the angular code which should push it into the table 这是应该将其推入表中的角度代码
// Add User
$scope.newUser = new Object();
$scope.addUser = function() {
if ($scope.newUser.email != undefined && $scope.newUser.name != undefined) {
$scope.table.push($scope.newPatient);
$scope.newUser = new Object();
}
}
Here's the codepen link with all the other code of the table 这是Codepen与表格中所有其他代码的链接
Your modal dialog is out of scope of your controller. 您的模态对话框超出了控制器的范围。 Look at HTML: 看一下HTML:
<div class="container ng-scope" ng-app="tableApp" ng-controller="mainController">
.....
</div>
<div id="add" class="modal fade in" role="dialog" style="display: block; padding-right: 17px;">
....
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.