Just felt like doing handson on this most frequently used lightning component.
As of the Spring ‘19 release (API version 45.0), you can build Lightning components using two programming models: the Lightning Web Components model and the original Aura Components model. Lightning web components and Aura components can coexist and interoperate on a page. This content covers Aura components.
public with sharing class Books4EveryoneHomeController {
@AuraEnabled
public static List<Book__c> getBooks(){
return [SELECT ID, Name, Description__c
FROM Book__c];
}
@AuraEnabled
public static List<Book__c> getBooksWithoutAuthors(){
return [SELECT Name
FROM Book__c
WHERE Author__c = null];
}
@AuraEnabled
public static List<Book__c> getBooksAndAuthor(){
return [SELECT Name, Description__c, Author__r.Name
FROM Book__c];
}
@AuraEnabled
public static List<Recommendation__c> getBookRecommendations(){
return [SELECT Name, Review__c, Rating__c, Book__r.Name , Book__r.Author__r.Name
FROM Recommendation__c
WHERE Book__c != null];
}
}
Then I created a Lightning component with configuration “Lightening Page” with below code. Lightning Card is something new i used it for first time…