LogoLogo
Enterprise GuideCommunity Edition GuideDeveloper Guide
  • Using The Polarity Developer Guide
  • Quick Start
    • What's New
    • Installing Integrations
    • Quick Start Guide
    • Learning Resources
  • Building an Integration
    • Directory Layout
    • package.json
    • Configuration File
    • Integration Main Module
      • startup
      • doLookup
        • Entity Objects
        • Result Objects
        • Error Objects
      • onDetails
      • onMessage
      • validateOptions
    • Customizing the Overlay Window
      • Templates
        • Conditionals
        • Displaying a List of Items
        • Display Object Properties
        • Built-in Helpers
        • Displaying Icons
      • Component File
        • Aliased Properties
        • Computed Properties
        • Event Hooks
      • CSS Styles
    • Vendor Javascript
      • Inserting Javascript into DOM
    • README Guide
    • Debugging Integrations
      • Web Inspector
      • Using Integration Logs
      • Testing Main Module
  • Recipes
    • Enabling User Actions
    • Throttling Lookups
    • Using Custom Entity Types
    • Custom Summary Tags
    • Creating a Tabbed Interface
    • Accessing Username of Requestor
Powered by GitBook
On this page
  1. Building an Integration
  2. Customizing the Overlay Window
  3. Component File

Aliased Properties

You can create aliases for properties to make them easier to reference.

As an example, the following is an alias for block.data.details

block.js
'use strict';

polarity.export = PolarityComponent.extend({
    details: Ember.computed.alias('block.data.details')
});

Once you have created an alias (in this case the alias details which refers to block.data.details you can reference the property from your template or from within your component just as you would any other variable.

template.hbs
<div>
    {{details.stuff}} is the same as {{block.data.details.stuff}}
</div>

You can also access details directly in your component file as well.

block.js
'use strict';

polarity.export = PolarityComponent.extend({
    details: Ember.computed.alias('block.data.details')
    severityColor: Ember.computed('details', function(){
        // here we can access 'details' directly because of our alias
        // without the alias we would need to explicitly request
        // `block.data.details.severity'
        let severity = this.get('details.severity');
        return severity > 50 ? "red" : "green";
    });
});
PreviousComponent FileNextComputed Properties

Last updated 5 years ago