I am trying to add google hangouts button to make calls by emails. If I hardcoded the email button works fine but Can I use a string variable for invite id so I can dynamically render hongout buttons? Example: invites[{ id : person.email }].
<g:hangout render="createhangout"
invites="[{ id : '[email protected]', invite_type : 'EMAIL' }]">
</g:hangout>
Here is the repeater code block. What am I missing?
<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 : '{{person.email}}', invite_type : 'EMAIL' }]">
</g:hangout>
</li>
</ul>
But also I am trying to update and add new persons so to create hangout buttons dynamically. I think my main problem is that.Here is the all code.
<!DOCTYPE html>
<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 : '{{person.email}}', 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 = [];
$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>
you can do this using {{}} in the snippet i've also added a repeater so you can make a bunch of these on the fly.