Angularjs how to add google-hangouts button dynamcally by ng-repeat

687 views Asked by At

I am trying to integrate google hangouts to a simple angularjs app. I am trying to add new person and refresh list dynamically. I am using ng-repeat but I cannot render a hangouts button into 'li ng.repeat' code block. Can you help how can I dynamically render hangouts button?

Code is below and one more thing that I want to ask. Can I invite people not by exact email but by a string variable such as: "invites[{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 : '[email protected]', 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: '[email protected]'}];
            $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>

0

There are 0 answers