Created
November 9, 2017 14:43
-
-
Save alexandrecruz/82dc9a229665b3c6a97387bb9f8c7325 to your computer and use it in GitHub Desktop.
Try to load Youtube iframe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Youtube avilability detector | |
// --- | |
// Cases: $scope.youtubeAvilable | |
// null - Not completed the request yet | |
// true - Youtube API and iframe loaded | |
// false - Youtube API and iframe could not be laoded | |
$scope.youtubeAvilable = null; | |
$.get('https://www.youtube.com/iframe_api') | |
.then(function(){ | |
// now we can set an indicator that youtube is loadable | |
$scope.youtubeAvilable = true; | |
}) | |
.fail(function(){ | |
// something went wrong.. | |
$scope.youtubeAvilable = false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment