S
S
Sergey2015-12-08 10:56:19
JavaScript
Sergey, 2015-12-08 10:56:19

Else if for view angularjs?

Is it possible to perform a construction of the form in the template
{{$first ? 'autoplay' : 'autobuffer}}
or

{{'autoplay' | $first}}
{ {'autobuffer' | !$first}}

You need to add a certain attribute depending on the variable.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2015-12-08
@Sergamers

Nicholas

<video
  ng-repeat="src in video"
  poster="{{poster}}"
  {{$first ? 'autoplay' : 'autobuffer'}}
  ng-show="$first"
  src="{{src}}"></video>

S
SirMustache, 2015-12-08
@SirMustache

Maybe something like this:

<video ng-attr-autoplay="{{vm.autoplay ? 'true' : 'false' }}"></video>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question