i trying use accordion or panel in angular 2.0.0-beta.15, when tried make work, have following message "property 'ngondestroy' missing in type 'ngbaccordiongroup"
import {bootstrap} '@angular/platform-browser-dynamic'; import {component, ondestroy} '@angular/core'; @component({ selector: 'ngb-accordion,[ngb-accordion]', inputs: ['onlyoneopen: closeothers'], template: `<ng-content></ng-content>` }) export class ngbaccordion { private onlyoneopen: boolean; private groups: array<ngbaccordiongroup> = []; addgroup(group: ngbaccordiongroup): void { this.groups.push(group); } closeothers(opengroup): void { if (!this.onlyoneopen) { return; } this.groups.foreach((group: ngbaccordiongroup) => { if (group !== opengroup) { group.isopen = false; } }); } removegroup(group: ngbaccordiongroup): void { const index = this.groups.indexof(group); if (index !== -1) { this.groups.splice(index, 1); } } } @component({ selector: 'ngb-accordion-group,[ngb-accordion-group]', inputs: ['heading', 'isopen', 'isdisabled'], template: ` <div class="card"> <div class="card-header"> <a href tabindex="0"><span [class.text-muted]="isdisabled" (click)="toggleopen($event)">{{heading}}</span></a> </div> <div class="card-block" [hidden]="!isopen"> <div class="card-text"> <ng-content></ng-content> </div> </div> </div> ` }) export class ngbaccordiongroup implements ondestroy { private isdisabled: boolean; private _isopen: boolean = false; constructor(private accordion: ngbaccordion) { this.accordion.addgroup(this); } toggleopen(event) { event.preventdefault(); if (!this.isdisabled) { this.isopen = !this.isopen; } } ondestroy(): void { this.accordion.removegroup(this); } public isopen(): boolean { return this._isopen; } public set isopen(value: boolean) { this._isopen = value; if (value) { this.accordion.closeothers(this); } } } @component({ selector: 'my-app', templateurl: './src/app.html' directives: [ngbaccordion, ngbaccordiongroup] }) export class app { firstdisabled:boolean = false; isopen:boolean = false; } bootstrap(app, []).catch(err => console.error(err));
or take here http://plnkr.co/edit/we3esk?p=preview right working in rc1 have make angular 2.0.0-beta.15
any thoughts?
ondestroy(): void { this.accordion.removegroup(this); }
should be
ngondestroy(): void { this.accordion.removegroup(this); }
the error message comes
... implements ondestroy {
without implementing members.