Closed kairajohnson closed 8 years ago
You're really close!
You don't need that AppCtrl thing. Just delete it and put everything in there in your HomeIndex controller.
You also don't need to put those quotes around the video_url
:
function homeIndexCtrl(Contributor){
var vm = this;
Contributor.query(function(contributors){
var video_url = contributors[0].video_url
vm.contributors = contributors;
vm.youTubeURL= video_url;
vm.youTubeShareURL = "";
vm.youTubeEmbededURL = "";
vm.vimeoURL = "";
console.log(vm.youTubeURL)
});
}
Then in your home-index.html
get rid of the AppCtrl
parts since you don't need that anymore. Finally, as with anything else in a controller's view, put homeVM
before the youTubeURL
:
<!-- <div data-ng-repeat="contributor in homeVM.contributors"> -->
<div anguvideo ng-model="homeVM.youTubeURL" width="100%"></div>
<!-- </div> -->
thank yoouuuuuuuu :) :) :) :) :)
👍
Hello, I took the instruction to use vm rather than $scope for the angular-video npm I am using and am able to target an individual url form my db but the actual video isn't showing.
Here is my code and repo: https://github.com/kairajohnson/gentrification.git
.controller("AppCtrl", ['Contributor', '$scope', function (Contributor) { var vm = this; Contributor.query(function(contributors, $scope){ var video_url = contributors[0].video_url vm.contributors = contributors; vm.youTubeURL= '"' + video_url + '"'; vm.youTubeShareURL = ""; vm.youTubeEmbededURL = ""; vm.vimeoURL = ""; console.log(vm.youTubeURL) }); }]);