I am trying to use angular and bootstrap to create a modal window that displays a youtube video. Following the modal example on the angular bootstrap page worked fine when I hard coded the youtube URL. However when I try to create a variable with the URL in it when the video is selected, I can't seem to keep that variable declared/changed in the instance of the modal window.
Here is a plunker demonstrating my problem in the modal example from the Angular site: http://plnkr.co/edit/n1vfSJUhcJWjNlfVrpxA?p=preview
The button that launches the modal window calls two functions when clicked: open() and my testFunction().
<button class="btn btn-default" ng-click="testFunction(); open()">Open me!</button>
This testFunction simply assigns a new value to a $scope variable:
$scope.testFunction = function(){
$scope.testFromFunction = "Hey this is a test that was changed in that function!";
};
How can I get <p>{{testFromFunction}}</p> in the modal window to reflect this variable assignment in the modal window? (should say "Hey this is a test that was changed in that function!", rather than "still unchanged")
The testFunction equivalent function in my actual app takes the $index and uses it to create the proper youtube URL. I need to dynamically create individual youtube links and cannot hard code them into the html/js.
Thank you very much for your time. Let me know if you need more information or if anything is unclear.