我正在尝试将google环聊整合到一个简单的angularjs应用中。 我正在尝试动态添加新人和刷新列表。我正在使用ng-repeat但是我无法将一个环聊按钮渲染到'li ng.repeat'代码块中。你能帮我怎样动态渲染环聊按钮?
代码在下面,还有一件我想问的问题。我是否可以通过确切的电子邮件邀请人员,但通过字符串变量邀请人员,例如:“邀请[{id:person.email} ...”
<html data-ng-app="hangoutApp">
<body>
<div data-ng-controller="SimpleController">
<h2>Add a person to contact:</h2>
<br />
Enter Name:
<input type="text" data--ng-model="name" />
<br />
<br />
Enter Surname:
<input type="text" data--ng-model="surname" />
<br />
<br />
Enter Email:
<input type="text" data--ng-model="email" />
<br />
<br />
<button ng-click="addPerson()">Add New Person</button>
<br />
<br />
<ul>
<li data-ng-repeat="person in contacts | orderBy:'name'">{{person.name}} {{person.surname | uppercase}} --> {{person.email}} - <button ng-click="del($index)">Delete</button>
<g:hangout render="createhangout"
invites="[{ id : 'foo@gmail.com', invite_type : 'EMAIL' }]">
</g:hangout>
</li>
</ul>
</div>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script src="Scripts/angular.min.js"></script>
<script>
var hangoutApp = angular.module('hangoutApp', []);
var controllers = {};
controllers.SimpleController = function SimpleController($scope) {
$scope.name = "";
$scope.surname = "";
$scope.email = "";
$scope.contacts = [{name: 'mesut', surname:'osman', email: 'osmangurlek10@gmail.com'}];
$scope.addPerson = function () {
this.contacts.push({
name: this.name,
surname: this.surname,
email: this.email
});
}
$scope.del = function (ind) {
this.contacts = this.contacts.splice(ind, 1);
};
}
hangoutApp.controller(controllers);
</script>
</body>