+ Start a Discussion
prasanth puvvada 4prasanth puvvada 4 

problem with simple if statement in aura component.

I want to display the todays date . so i created this component and insetedinto the aura:application.  at loading this page i am getting this error.

Error during init : Unable to find 'checkWeekday' on 'compound://c.MOTD1'.​
<aura:component implements="force:appHostable">
    <aura:attribute name="{!v.dayofweek}" type="string" default=""/>
    <aura:handler name="init" value="{!this}" action="{!c.callday}" />
    <aura:if isTrue="{!v.dayofweek == 'sunday' }" >
    <b>This is {!v.dayofweek} </b>
    <aura:if isTrue="{!v.dayofweek == 'monday'}" >
    <b>This is {!v.dayofweek} </b>
    <aura:if isTrue="{!v.dayofweek == 'tuesday' }">
    <b>This is {!.dayofweek} </b>
    <aura:if isTrue="{!v.dayofweek == 'weds' }" >
    <b> This is {!v.dayofweek} </b>
	checkday : function(component) {
		var d= new Date();
        var weekday=new Array(7);
        weekday[0]= "sunday";
        var n=weekday[d.getday()];

Krishna SambarajuKrishna Sambaraju
In your component the handler "init" is calling an action "c.callday", but the function you created is "checkday". Change the function to "callday" and check it.