Calculator for Addition,Subtraction,Multiplication,Divided
Here is the code for Calculator:
Lightening Application :
<aura:application >
<aura:attribute name= "text" type ="integer" />
<aura:attribute name= "Mytext" type ="integer" />
<aura:attribute name= "MMYtext" type ="integer"/>
<ui:inputnumber label = "Inpupt 1" value="{!v.text}" updateOn="Click"/>
<ui:inputnumber label = "Inpupt 2" value="{!v.Mytext}" updateOn="Click"/>
Final Result: <ui:outputnumber value="{!v.MMYtext}"/>
<ui:button label ="Press Me" press ="{!c.Pressme}"/>>
<ui:button label ="Press Minus" press ="{!c.PressMinus}"/>
<ui:button label ="Press MultiPlication" press ="{!c.MultiPlication}"/>
<ui:button label ="Press Divide" press ="{!c.Divide}"/>
</aura:application>
Lightening Controller JS:
({
Pressme : function(component, event, helper) {
component.set("v.MMYtext", component.get("v.text")+component.get("v.Mytext"));
component.set("v.MMYtext", component.get("v.text")+component.get("v.Mytext"));
},
PressMinus : function(component, event, helper) {
component.set("v.MMYtext", component.get("v.text")-component.get("v.Mytext"));
},
MultiPlication : function(component, event, helper) {
component.set("v.MMYtext", component.get("v.text")*component.get("v.Mytext"));
},
Divide : function(component, event, helper) {
component.set("v.MMYtext", component.get("v.text")/component.get("v.Mytext"));
}
})
Created by @Gaurav!!
No comments:
Post a Comment