Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
158
rated 0 times [  160] [ 2]  / answers: 1 / hits: 17600  / 9 Years ago, mon, july 20, 2015, 12:00:00

Can someone please provide an example of proper implementation of dom-if?



No example of proper usage is provided by the official documentation. (Sorry there is no direct link. Must use menu in upper left and select dom-if).



Here is what I have so far. Obviously, it is not working.



<template>
...
<template is=dom-if if={{action}}=='Login'>
<!-- Also tried: if={{action=='Login'}} -->
<a href=#>Forgot password?</a>
</template>
...
</template>

More From » api

 Answers
1

It's cumbersome, but you have to do this:



<template is=dom-if if=[[_actionIsLogin(action)]]>
<a href=#>Forgot password?</a>
</template>

<script>
Polymer({
...
_actionIsLogin: function(action) {
return action === 'Login';
}
...
});
</script>


Explicitly create a function that returns either true or false.


[#65752] Thursday, July 16, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
magdalena

Total Points: 364
Total Questions: 101
Total Answers: 92

Location: Namibia
Member since Mon, Nov 14, 2022
2 Years ago
magdalena questions
Thu, May 12, 22, 00:00, 2 Years ago
Fri, Jun 18, 21, 00:00, 3 Years ago
Fri, Mar 26, 21, 00:00, 3 Years ago
Thu, Oct 29, 20, 00:00, 4 Years ago
;