Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <aura:component controller="PrdConfigCls">
  2. <aura:attribute name="paramProductId" type="String"/>
  3. <aura:attribute name="product" type="PrdConfigCls.Product"/>
  4. <aura:handler name="change" value="{!v.paramProductId}" action="{!c.paramProductIdChangeEventHandler}"/>
  5.  
  6. <aura:iteration items="{!v.product.attributes}" var="attr">
  7. <c:ChildComponent attributeParam="{!attr}"/>
  8. </aura:iteration>
  9.  
  10. </aura:component>
  11.  
  12. <aura:handler name="change" value="{!v.paramProductId}" action="{!c.paramProductIdChangeEventHandler}"/>
  13.  
  14. ({
  15. paramProductIdChangeEventHandler : function(component, event, helper) {
  16. var paramProductId = component.get("v.paramProductId");
  17. if (paramProductId != null && paramProductId != '') {
  18. helper.loadProductConfiguration(component);
  19. }
  20. }
  21. })
  22.  
  23. ({
  24. loadProductConfiguration : function(component) {
  25.  
  26. var action = component.get("c.getProjectProductDefinition");
  27. action.setParams({ "projectProductId": component.get("v.paramProductId") });
  28. var self = this;
  29.  
  30. action.setCallback(this, function(a) {
  31. var productResp = a.getReturnValue();
  32. var product = JSON.parse(productResp);
  33. component.set("v.product", product);
  34. });
  35. $A.enqueueAction(action);
  36.  
  37. }
  38. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement