Newer Version Available

This content describes an older version of this product. View Latest

Creating an Apex Model

You must use a Developer Edition organization with a registered namespace.
  1. Click Your name | Developer Console.
  2. Click File | New | Apex Class.
  3. Enter a name for your model.
  4. Click OK.
  5. Add code to the model class.
    Remember to add the @AuraEnabled annotation for any getter that you want to access in markup or JavaScript.
  6. Click File | Save.
  7. Open the component that you want to wire to the new model class.
  8. Add a model system attribute to the <aura:component> tag to wire the component to the model. For example:
    1swfobject.registerObject("clippy.codeblock-0", "9");<aura:component model="myNamespace.MyApexModel" >