ambari-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Nechiporenko (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMBARI-19401) Add new macros `ifThenElseByKeys` and write UT
Date Fri, 06 Jan 2017 11:54:58 GMT
Oleg Nechiporenko created AMBARI-19401:
------------------------------------------

             Summary: Add new macros `ifThenElseByKeys` and write UT
                 Key: AMBARI-19401
                 URL: https://issues.apache.org/jira/browse/AMBARI-19401
             Project: Ambari
          Issue Type: Task
          Components: ambari-web
    Affects Versions: 3.0.0
            Reporter: Oleg Nechiporenko
            Assignee: Oleg Nechiporenko
             Fix For: 3.0.0


A computed property that returns value for trueKey property if dependent value is true and
falseKey-value otherwise

{code:javascript}
var o = Em.Object.create({
  p1: true,
  p2: 1,
  p3: 2,
  p4: Em.computed.ifThenElseByKeys('p1', 'p2', 'p3')
 });
 console.log(o.get('p4')); // 1
 o.set('p1', false);
 console.log(o.get('p4')); // 2

 o.set('p3', 3);
 console.log(o.get('p4')); // 3
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message