I have a created a Lightning App having 2 Components -
- Login Page
- Registration Page
After Logging in (One Time Login) the Sales person is taken to Registration Page. The event participants are then handed over the IPAD to fill in there details on Registration form. The Submit button on Registration page Saves data into Salesforce and refreshes the registration page. So the IPAD is then handed over to next participant and so on.
This functionality is working perfectly fine if I access the App using the lightning URL. Now I have to add the app to Salesforce1 Navigation menu. I added both components as Lightning Component Tabs and added them to Salesforce1 Mobile Navigation Menu. However When I click on Login button the control does not navigate to the Registration Page. Below is the code I have written for form navigation:-
App Event Handler
The Event Handler is defined in The App as -
event="c:navigateToForm" action="{!c.navigateToForm}"
AppController.js - Contains method to navigate to Registration form
navigateToForm : function(component, event, helper) {
console.log("Inside Navigate To Form method forming URL>>>>>>>>>>>>>>>>>");
var dest = "markup://c:" + event.getParam("view") + "Form";
console.log("event.getParam>>>>>>>>>>>>>>>>>" + event.getParam("view"));
$A.componentService.newComponentAsync(this, function(view) {
console.log("Inside Navigate To Form method >>>>>>>>>>>>>>>>>");
console.log("Hellooooooooooooooooooooo");
console.log("!v.presName >>>>>>>>>>>" + component.get("v.presName"));
var content = component.find("content");
content.set("v.body", view);
//component.set("v.body", "Hello World!");
}, {
componentDef: dest,
attributes: {
values: {
presName: "{!v.presName}",
presDate: "{!v.presDate}",
evtName: "{!v.evtName}"
}
}
}, component);
}
Button:- Inside the Login Component Login Button calls c.gotoForm method which then calls the event to navigate to Registration Form.
<aura:component controller="loginFormController" access="global" implements="force:appHostable">
<ui:button class="btn-xlarge" label="Login" press="{!c.gotoForm}"/>
</aura:component>
gotoForm Method:-
gotoForm : function(component, event, helper) {
console.log("Navigating to Regitration Form >>>>>>>>>>>>>>>>>");
//helper.getUserDetails(component);
var evt = $A.get("e.c:navigateToForm");
console.log("Navigating to Regitration Form 111111111111111>>>>>>>>>>>>>>>>>");
/*evt.setParams({
componentDef: "c:registrationForm"
});*/
console.log("Navigating to Regitration Form 333333333333333>>>>>>>>>>>>>>>>>");
//evt.fire();
evt.setParams({view: "registration"}).fire();
component.set("v.showLogin",false);
component.set("v.loggedIn",true);
}
navigateToForm Event:-
<aura:event type="APPLICATION" >
<aura:attribute name="view" type="String" required="true"/>
</aura:event>
The control goes till the "Navigating to Regitration Form 333333333333333>>>>>>>>>>>>>>>>>"
Am I missing something here? How can I make the app accessible through Salesforce1? What I understand here is the system is unable to find the navigateToForm Event. How can I resolve this issue?
Thanks