You need to sign in to do that
Don't have an account?
Arpit Vashishtha 7
calculating day of week on component without controller js..
provided challange is: Create a Message of The Day component that displays different text based on an attribute...
https://developer.salesforce.com/trailhead/lex_dev/lightning_components/lightning_components_expressions
i completed this challenge but traihead is not accepting it.. it is giving me error. i.e. :
Challenge not yet complete... here's what's wrong:
The component is not evaluating the value of the 'DayOfTheWeek' attribute to determine what to display
but when i execute my component it gives me desired output....
https://developer.salesforce.com/trailhead/lex_dev/lightning_components/lightning_components_expressions
i completed this challenge but traihead is not accepting it.. it is giving me error. i.e. :
Challenge not yet complete... here's what's wrong:
The component is not evaluating the value of the 'DayOfTheWeek' attribute to determine what to display
but when i execute my component it gives me desired output....
This is a hack if you ask me, but this is how I got Trailhead to accept my challenage.
MOTD.cmp MOTDController.js
Let me know if you find a better way. Thanks.
That's work fine too.
<ui:inputText aura:id="dayname" label="Day"
value="{!v.DayOfTheWeek}"
required="true"/>
<aura:if isTrue="{!v.DayOfTheWeek != ''}">
<aura:if isTrue="{!v.DayOfTheWeek == 'Monday'}">
Today is {!v.DayOfTheWeek}
</aura:if>
<aura:if isTrue="{!v.DayOfTheWeek == 'Tuesday'}">
Today is {!v.DayOfTheWeek}
</aura:if>
<aura:if isTrue="{!v.DayOfTheWeek == 'Wednesday'}">
Today is {!v.DayOfTheWeek}
</aura:if>
<aura:if isTrue="{!v.DayOfTheWeek == 'Thursday'}">
Today is {!v.DayOfTheWeek}
</aura:if>
<aura:if isTrue="{!v.DayOfTheWeek == 'Friday'}">
Today is {!v.DayOfTheWeek}
</aura:if>
<aura:if isTrue="{!v.DayOfTheWeek == 'Saturday'}">
Today is {!v.DayOfTheWeek}
</aura:if>
<aura:if isTrue="{!v.DayOfTheWeek == 'Sunday'}">
Today is {!v.DayOfTheWeek}
</aura:if>
</aura:if>
MOTD.cmp
MOTDcontroller.js
Component:
Controller:
Component:
Controller:
use this code:
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi