I have a VF page where i am creating a lightning component(createComponent and App using ltng:outApp
).
In this lightning component i am trying to use lightning:navigation
.
Also tried using e.force:navigateToComponent. Both of them are not working. I am getting
Error: Cannot read property 'setParams' of undefined.
I tried to call the component even without any parameters. Its not working.
Best Answer
The time you use lightning out on your VF page, you are using it through a Lightning App, and that any component you create is created within that app. So in turn your Lightning Component is running inside an app, within the VF page.
A good way to verify if a component is supported or not is to look at the Experience section of any component's documentation on the documentation site.
If you take a look at lightning:navigation documentation, this component is not supported in Lightning Application but only in Lightning Experience and Salesforce Mobile App.