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

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -