1
I am building a hybrid APP with Ionic, this uses Angular and I am not very familiar with JS.
The point is that I need to insert a Youtube video into the file and ran into the following question: The video link comes from an external API and therefore needs to be entered into the code by a variable and yet I can’t make it work.
Follows a code that exemplifies the problem, where video does not appear in the iframe.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<title>AngularJs</title>
</head>
<body ng-app>
<div ng-controller="Ctrl">
<p>Link: {{link}}</p>
</div>
<iframe src="{{ link }}" frameborder="0" allowfullscreen="" width="560" height="315" style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
<script src="http://code.angularjs.org/1.2.1/angular.min.js"></script>
<script>
function Ctrl($scope){
$scope.link = "https://www.youtube.com/watch?v=Hl3aJms0xGQ";
}
</script>
</body>
</html>
The same occurs in this case:
<button id="encontrar-button1" class="button button-balanced button-block icon-left ion-plus-circled" onclick="window.open('http://www.site.com/pagina/{{ url }}/{{ .id }}/', '_system', 'location=yes'); return false;">Link</button>
It worked for the video. What about the second case, window.open? Thank you for replying Jhonny.
– Leonel Junior
I updated the code but Stackoverflow is blocking the popup. Here’s the same example on Jsfiddle. But if your intention is to make a window "popup" you could try working with modals this would avoid future problems with popup blockers -> Modals Ionic
– Jhonny Roger Virgilio da Silva