39

Launch video file from Google maps InfoWindow() with ionic

November 30, 2015

Publicidad / Advertisement

Working the Google Maps API in ionic framework and doing common things like create a simple marker with a simple infoWindow is easy, but when you try to go beyond things sometimes are a little hard.   I have used this great tutorial which works perfectly
http://devdactic.com/images-videos-fullscreen-ionic/1

but now I am trying to put a video link inside  google.maps.InfoWindow() , in the property content, like this:

var str_content = '
<div><button data-tap-disabled="true" class="button button-clear button-positive" ng-click="playVideo(\'' + str_url_video + '\')">Play '+ name +'</button></div>';
 
var myinfowindow = new google.maps.InfoWindow({ content: str_content });

Unfortunately, it is not working properly, because the directive ng-click is been ignored inside google maps code, and therefore the video is not shown.  What can we do ?

To fix this issue it is necessary to compile the string in order to add the behaviuor inside the DOM.

var compiled = $compile(str_content)($scope);
var str_content = compiled[0];

and above, in the controller add $compile

.controller('nameController', function($scope, ..., $compile) {

That´s all. i hope it works for you too.

Publicidad / Advertisement

 

Topics: Desarrollo web, ionic framework | No Comments »

Comments