DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
    • can-component
    • can-compute
    • can-connect
    • can-define
    • can-define/list/list
    • can-define/map/map
    • can-route
    • can-route-pushstate
    • can-set
    • can-stache
      • Pages
        • Magic Tag Types
        • Scope and Context
        • Expressions
        • Template Acquisition
        • Helpers
        • Live Binding
      • Methods
        • from
        • registerConverter
        • registerHelper
        • registerPartial
        • registerSimpleHelper
        • safeString
      • Tags
        • {{expression}}
        • {{{expression}}}
        • {{#expression}}
        • {{/expression}}
        • {{^expression}}
        • {{>key}}
        • {{!expression}}
        • {{else}}
      • Expressions
        • Bracket Expression
        • Call Expression
        • Hash Expression
        • Helper Expression
        • KeyLookup Expression
        • Literal Expression
      • Key Operators
        • @at
        • ~compute
        • ./current
        • ../parent
        • %special
        • this
        • *variable
        • key
      • Helpers
        • {{#if expression}}
        • {{#unless expression}}
        • {{#each expression}}
        • {{#with expression}}
        • {{log}}
        • {{#is expressions}}
        • {{#switch expression}}
        • {{#case expression}}
        • {{#default}}
        • {{joinBase expressions}}
      • Types
        • getterSetter
        • helper
        • helperOptions
        • renderer
        • sectionRenderer
        • simpleHelper
    • can-stache/helpers/route
    • can-stache-bindings
  • Ecosystem
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Core
  • /
  • can-stache
  • /
  • {{#is expressions}}
  • / On this page
    • {{#is expressions}}

      function

      Render something if two values are equal.

      • source

      {{#is [EXPRESSION...]}}FN{{else}}INVERSE{{/is}}

      Renders the FN if every EXPRESSION argument is equal (===).

      {{#is user.type "admin"}} <button/> {{else}}  Login {{/is}}
      {{#is task.ownerId task.assignedId user.id }} Delegate! {{/is}}
      

      Parameters

      1. EXPRESSION {Literal Expression|KeyLookup Expression|Call Expression}:

        Two or more expressions whose return values will be tested for equality.

      2. FN {sectionRenderer(context, helpers)}:

        A subsection that will be rendered if each EXPRESSION argument is equal.

      3. INVERSE {sectionRenderer(context, helpers)}:

        An optional subsection that will be rendered if one of the EXPRESSION arguments is not equal to one of the others.

      Use

      The is helper compares expr1 and expr2 and renders the blocks accordingly.

      {{#is expr1 expr2}}
          // truthy
      {{else}}
          // falsey
      {{/is}}
      

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.