I'm trying to create a link to redirect to Contact. Component
<aura:attribute name="Contacts" type="Contact[]"/>
<aura:iteration items="{!v.Contacts}" var="con">
<tr>
<td><a onclick="{!c.navigateToRecord}" style="width:100%;">{!con.Name}</a></td>
<td> {!con.Email} </td>
<td> {!con.Contact_level__c} </td>
<td> {!con.Account.Name} </td>
<td> {!con.Owner.Name} </td>
<td> {!con.CreatedBy.Name} </td>
<td> {!con.CreatedDate} </td>
Controller
navigateToRecord : function(component, event, helper) {
var navEvent = $A.get("e.force:navigateToSObject");
navEvent.setParams({
recordId: component.get("v.contact").Id,
slideDevName: "detail"
});
Console.log("hey");
navEvent.fire();
I get this Message
Cannot read property 'setParams' of undefined
Help me PLS, WHY?