javascript - Unable to add Hangouts button to HTML template within script tags -
on index page, when add hangouts button below drawn & works expected.
<body ng-app="sampleapp" ng-controller="mainctrl"> <div class="row"> <div class="col-md-12 m-body"> <div class="m-header-text"> hello friend </div> <g:hangout render="createhangout"></g:hangout> <div> <!-- insert html view templates here --> <ui-view></ui-view> </div> </div> </div> <!-- on --> </body> but when place inside template, displayed based on url route, hangouts button not drawn & cannot seen in ui.
<script type="text/ng-template" id="/home.html"> <div class="col-md-12 m-grid m-rowbg m-border"> <div ng-repeat="peers in lop"> hey {{peer.username}} call peer <g:hangout render="createhangout"></g:hangout> </div> </div> </script> could please tell me why not being drawn & should button displayed? of great !
using angularjs.
i had same issue, , found solution using angular directives.
the problem rendering button google tag markup rendering executes when platform.js script loads, before angular loads template.
so solution call google api render function after angular loaded template. did creating angular custom directive link function :
hangoutbutton.directive('hangoutbutton', function() { return { restrict: 'e', template: '<div id="hangout-button"></div>', link: function (scope, element, attrs) { gapi.hangout.render('hangout-button', {'render': 'createhangout'}); } }; }); then can display in template custom element :
<div class="col-md-12 m-grid m-rowbg m-border"> <div ng-repeat="peers in lop"> hey {{peer.username}} call peer <hangout-button></hangout-button> </div> </div>
Comments
Post a Comment