Solution #4: Sort Roster
Explore how to implement sorting in your attendance app by adding a button that sorts students by last name. Learn to use Ionic's button components and Angular's native array sort function to update the roster dynamically.
We'll cover the following...
We'll cover the following...
Solution
import { AppPage } from './app.po';
describe('new App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
describe('default screen', () => {
beforeEach(() => {
page.navigateTo('/Inbox');
});
it('should say Inbox', () => {
expect(page.getParagraphText()).toContain('Inbox');
});
});
});
Solution: Sort Roster
Explanation
-
TypeScript arrays have a
sortfunction. Provide a button in the Roster toolbar to sort by the students’ last names instead of the current default.