javascript - Ember.js - Fading in an if statement -
I want to easily fade an error for a field, and I have some problems finding the flow for it. Are I Ember.js. At the moment there is a fashion in the error period and there is no effect. My index template looks like this.
& lt; script type = "text / x-handlebars" data-template-name = "index" & gt; & Lt; div class = "errorbox" & gt; {{#if error}} & lt; span class = "error" & gt; {{Error}} & lt; / Span & gt; {{/ If}} & lt; / Div & gt; & Lt; Label & gt; what is your name? & Lt; / Label & gt; {{Input Type = "Text" Action = "Type" Value = Username}} & lt; / Script & gt; and my controller:
App.IndexController = Ember.ObjectController.extend ({actions: {type: function () {if (this.get ('Username'). Length & gt; 10) this.set ('error', 'username over length!'); Else this.set ('error', null);}}, / * properties * / Error: false, username: wrong}}; Is this an easy way to do this?
A simple way to do this is to use CSS animations to make effects:
.error {-webkit-animation: fadeIn 1s Ease; animation: feedin 1 From {opacity: 0.0} to {Opacity: 0.0} to {Opacity: 0.0} to {Opacity: 1.0}} @keyframes {{opacity: 0.0} to {Opacity: 1.0}} Example:
Comments
Post a Comment