Rares
Rares

Reputation: 637

How can I load value from AngularJS controller to HTML Thymeleaf tag

Can I do:

<source th:src="@{{{videoPathsTh[$index]}}}" type="video/mp4"></source>

Like this:

<source scr="{{videoPaths[$index]}}" type="video/mp4"</source>

Or how can I load values from the controller in th:src? Can you provide me another way?

Update

<li ng-repeat="video in videos">Video-ul: {{$index+1}} >
    <video width="300" controls="controls">
        <source ng-src="{{videoPaths[$index]}}"
                th:src="@{{{videoPathsTh[$index]}}}" type="video/mp4">
        </source>
    </video>
</li>

Update:

Apparently Thymeleaf it loads the video successfully if I leave the source like this:

<source th:src="@{{{videoPathsTh[$index]}}}" type="video/mp4"></source>

or

<source src="{{videoPaths[$index]}}" th:src="@{{{videoPathsTh[$index]}}}" type="video/mp4"></source>

But I receive this error:

Failed to load resource: the server responded with a status of 404 () - /%7B%7BvideoPathsTh[$index]%7D%7D

I think it's because the server loads the HTML file before Client loads the page and the AngularJS controller can't send the values.

Upvotes: 2

Views: 90

Answers (1)

Rares
Rares

Reputation: 637

I guess it's not possible...Thanks

Upvotes: 1

Related Questions