Using <template is="dom-if" with a condition

you have to define your function.

<template is="dom-if" if="[[_isEqualTo(title, 'Foo')]]">

and then in script:

function _isEqualTo(title, string) {
  return title == string;
}

whenever is property title changed, function _isEqualTo is called. so you don't have to take care of observing property or something.

function _isEqualTo is called with 2 parameters, the second one is just plain string you want to compare some value with.


If your data was such that Foo was boolean or had an attribute that "Foo":true or "isFoo":true . Then you could just do:

<template is="dom-if" if="{{isFoo}}">
   Foo
</template>

The only logic you can use in a binding is not. for instance:

<template is="dom-if" if="{{_isEqualTo(title, 'Foo')}}">
<template is="dom-if" if="{{!_isEqualTo(title, 'Foo')}}">