Bootstrap collapse component

Let's try another example, but this time we will bind to events as well. For this example we will use another widget from the bootstrap library called collapse. In the components folder, create a new folder named collapse. Inside it, create a file named collapse.ts for our component and a file named collapse.html for the component template.

Open collapse.ts and paste the following code. This is an example collapse widget that was taken as-is from the bootstrap website (http://getbootstrap.com/javascript/#collapse):

[collapse.ts] import { Component, AfterViewInit } from '@angular/core'; import * as $ from 'jquery'; @Component({ selector: 'collapse', templateUrl: './collapse.html' }) export class Collapse implements AfterViewInit ...

Get Angular 2 Components now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.