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
Deepak agarwal 9Deepak agarwal 9 

Aura:if Error on setting the value

Hi All,

I need help in resolving the error. I have declared a attribute name="flag" and doing some condition check and then setting the attribute value to
 something inside if.But i am getting the following error.
Failed to save undefined: The attribute "flag" was not found on the COMPONENT markup://aura:if: Source​
<aura:attribute name="flag" default="0"/>
<div class="slds">  
        <div class="slds-container--center slds-container--small slds-container--medium">
              <aura:iteration items="{!v.ZenObjsnew}" var="zenobjsnew" aura:id="iter">
            <div class="slds-grid slds-wrap">
              <aura:set attribute="flag" value="0"/>
                       <aura:if istrue="{!lessthan(v.flag,2)}">
                <div class="slds-size--12-of-12 slds-small-size--6-of-6 slds-medium-size--6-of-12 slds-large-size--6-of-12 blue-bg ">
                    <div class="slds-size--1-of-2">
                    <div class="slds-grid slds-wrap content-box">
                        <div class="slds-size--12-of-12 slds-medium-size--3-of-12">
                            <img src="{!v.imagepath1}" alt="{!v.imagetext1}"/>
                        <div class="slds-size--12-of-12 slds-medium-size--9-of-12">
                            <h4 class="liheading"> 
                                <a href="{!v.linkpath1}">
                            <p class="text-limit">{!v.linktext1}
                            <p class="language  spacer">Chinese 
                                        <a href="javascript:void(0)">????
                                        </a> | Korean 
                                        <a href="javascript:void(0)">???
                                        </a> | French 
                                        <a href="javascript:void(0)">Français
                                        </a> | Japanese 
                                        <a href="javascript:void(0)">???
                <aura:set attribute="flag" value="{!add(v.flag,1)}"/>    

Thanks in Advance,
First thing I notice is you're missing the type on your attribute declaration. Add in the type and see if that fixes your issue.