Skip to main content
Ramzi Melliti 님이 #Lightning Experience에 질문했습니다
Hello all.

I learnt lightning component with trailhead Lightning component basic and now i need to call method without click on a button like trailhead. I want something like the <script> tag on HTML and code javascript inside and use getElemById()

I tried <script> tag into the component but it's impossible on lightning. So I search on internet but i didn't found the answer.

How can i do ?
답변 2개
  1. 2016년 12월 7일 오후 2:17

    I wish to call my method into an aura:iteration in this code :

    <div id="list" class="row">

    <div class="container">

    <!--<div class="inner">-->

    <aura:iteration items="{!v.products}" var="prod">

    <div class="info">

    <p>Nom: <ui:outputText value="{!prod.Name}"/></p>

    <p>Liké par: <ui:outputText value="{!prod.wishedBy__c}"/></p>

    <p>Prix: <ui:outputCurrency value="{!prod.Prix__c}"/></p><br/>

    </div>

    <div id="side"></div>

    </aura:iteration>

    <!--</div>-->

    </div>

    </div>

    this

    <aura:handler name="init" value="{!this}" action="{!c.doAction}"/>

    open an alert when i try to save with "Failed to save undefined: markup://c:pageGraph:20,91: Invalid attribute "name": Source". I'm able to save it when i place it outside this div (before or after).

    For the seconde problem about the returned value. Earlier in my code i have

    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>

    which return some values from my table. In action {!c.doAction}. I need those values but i get nothing. I place some console.log in those action. The console.log from doAction (the second one called) is displayed before the one in doInit (called first)