Salesforce Certified Application Architect

Friday 6 October 2017

Calculator for Addition,Subtraction,Multiplication,Divided in Lightening component !!


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

Salesforce Certified Application Architect & Certified Data Architecture and Management Designer Exam

How to pass Salesforce Certified Data Architecture and Management Designer Exam This exam was 1st architect exam for me. Its not that muc...