function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sergey VolinetsSergey Volinets 

I can't add custom apex class to type of aura:attribute.

I can't add custom apex class to type of aura:attribute.

I have no idea what happens.
<aura:component controller="CVP.TestTypes">
    
    <aura:attribute name="products" type="CVP.TestClass[]"/>

</aura:component>

And Apex
 
public class TestTypes {
    public class TestClass {
        @AuraEnabled
        public String name = 'Stan';
        @AuraEnabled
    	public Integer age = 12;
    }
}

 
Sergey VolinetsSergey Volinets
I have tried this one but I receive the error: TestTypes.TestClass: Types cannot be marked as AuraEnabled

Is it possible with inner classes? Yes, I believe it is, but how?
sfdcMonkey.comsfdcMonkey.com
hi
i write a post on it that how to access apex class property in lightning component
go to below link
https://teachforce.wordpress.com/2016/11/17/how-to-access-apex-class-property-in-lightning-component/ 
i hope it helps you
thanks
let me infome if it helps you :)
sfdcMonkey.comsfdcMonkey.com
Sergey VolinetsSergey Volinets
Thanks, man, but there is no any solution, as I understand lighting component does not support inner class.
https://success.salesforce.com/ideaView?id=0873A0000003OsmQAE 
sfdcMonkey.comsfdcMonkey.com
yes we can not access direct inner class in lightning component
 
mxstrandmxstrand
It is possible to access inner classes via namespacing, see https://success.salesforce.com/ideaView?id=0873A0000003OsmQAE

 <aura:attribute name="attributeName" type="LightningComponentController.InnerClass"/>