Calling $scope inside directive

I’ve been struggling with trying to get a $scope variable to appear in a directive (Vimeo player). Here is the HTML:

       <div class="item item-body">
      <vimeo-video player-id="video1" video-id="feeddata.id"></vimeo-video>
      <div class="welsfontfrut" ng-bind-html="feeddata.description"></div>
      <p><a href="#" class="subdued">Duration: {{feeddata.duration/60 | number:0}} minutes</a><br />
      <a href="#" class="subdued">Plays: {{feeddata.stats_number_of_plays}}</a><br />
      <a href="#" class="subdued">Tags: {{feeddata.tags}}</a></p>
      </div>

The video-id=“feeddata.id” is the issue. The directive reads “feeddata.id” instead of a video id that I’m passing to it. For instance 1003829. I can console.log the scope variable. All the other scope variables render correctly on the page. It’s just in the vimeo-video directive. I’ve tried “{{feeddata.id}}”, and many variations of that.

What am I doing wrong? Thanks much!

BTW, I can hardcode the video id into the directive and it works fine, so I know it works.

It depends on what the vimeo directive accepts for the video-id attribute.

Do you have a link to the vimeo directive?

I only found this:


and there your have to write “videoId” as the attribute name… take a look in the demo.

The directive is found in this project: https://github.com/vincenzomerolla/angular-vimeo-embed

I don’t think it has anything to do with directive itself however…although I could be wrong there too as I’m new to Angular and directives. The directive takes just a string…in this case a Vimeo video ID I’m getting through their API. As I said, I can hard code the ID into the directive and it works fine… it’s just when I’m trying to inject it via the scope.

Thanks for your reply.

try to print {{feeddata}} inside and outside the < vimeo-video >, and see what info gives to you, but it should work fine if the $scope.feeddata is an element in the controller.

I don’t think that this is due to the directive.

It prints outside the directive, but not inside the video-id attribute.

can you add a console log directly in the link function of vimeo directive and print out $scope.videoId or the whole scope?

Rename the $scope.feeddata to $scope.feed.data in both the controller and the view

But this is strange, because the bi-directional databinding should also work with $scope.feedback.
$scope.feedback is already an object and he is referencing to feedback.id.