refactor(aio): remove ngOnInit method

This commit is contained in:
Alexander Zhukov 2017-05-05 17:22:35 +03:00
parent 3e47df7526
commit 923e56c3d2
17 changed files with 37 additions and 103 deletions

View file

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-charts',
@ -6,8 +6,5 @@ import { Component, OnInit } from '@angular/core';
<p>charts work!</p>
`,
})
export class NgxChartsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxChartsComponent {
}

View file

@ -1,6 +1,5 @@
import {
Component,
OnInit,
OnDestroy,
AfterViewInit,
Input,
@ -21,10 +20,6 @@ import 'ckeditor';
</nga-card>
`,
})
export class NgxCKEditorComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxCKEditorComponent {
}

View file

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-editors',
@ -6,8 +6,6 @@ import { Component, OnInit } from '@angular/core';
<router-outlet></router-outlet>
`,
})
export class NgxEditorsComponent implements OnInit {
constructor() { }
export class NgxEditorsComponent {
ngOnInit() { }
}

View file

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, AfterViewInit, Input, Output, EventEmitter } from '@angular/core';
import { Component, OnDestroy, AfterViewInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'ngx-tinymce-editor',
@ -6,7 +6,7 @@ import { Component, OnInit, OnDestroy, AfterViewInit, Input, Output, EventEmitte
<textarea id="{{ elementId }}"></textarea>
`,
})
export class NgxTinyMCEEditorComponent implements OnInit, OnDestroy, AfterViewInit {
export class NgxTinyMCEEditorComponent implements OnDestroy, AfterViewInit {
@Input() elementId: string;
@ -14,10 +14,6 @@ export class NgxTinyMCEEditorComponent implements OnInit, OnDestroy, AfterViewIn
editor: any;
constructor() { }
ngOnInit() { }
ngAfterViewInit() {
tinymce.init({
selector: '#' + this.elementId,
@ -51,11 +47,7 @@ export class NgxTinyMCEEditorComponent implements OnInit, OnDestroy, AfterViewIn
</nga-card>
`,
})
export class NgxTinyMCEComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxTinyMCEComponent {
editorKeyupHandler($event) {
console.info($event);

View file

@ -1,14 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-buttons',
styleUrls: ['./buttons.component.scss'],
templateUrl: './buttons.component.html',
})
export class NgxButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxButtonsComponent {
}

View file

@ -1,13 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-disabled-buttons',
templateUrl: './disabled.component.html',
})
export class NgxDisabledButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxDisabledButtonsComponent {
}

View file

@ -1,13 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-dropdown-buttons',
templateUrl: './dropdown.component.html',
})
export class NgxDropdownButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxDropdownButtonsComponent {
}

View file

@ -1,13 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-flat-buttons',
templateUrl: './flat.component.html',
})
export class NgxFlatButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxFlatButtonsComponent {
}

View file

@ -1,13 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-group-buttons',
templateUrl: './group.component.html',
})
export class NgxGroupButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxGroupButtonsComponent {
}

View file

@ -1,13 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-icon-buttons',
templateUrl: './icon.component.html',
})
export class NgxIconButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxIconButtonsComponent {
}

View file

@ -1,13 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-large-buttons',
templateUrl: './large.component.html',
})
export class NgxLargeButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxLargeButtonsComponent {
}

View file

@ -1,13 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-raised-buttons',
templateUrl: './raised.component.html',
})
export class NgxRaisedButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxRaisedButtonsComponent {
}

View file

@ -1,13 +1,9 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-sized-buttons',
templateUrl: './sized.component.html',
})
export class NgxSizedButtonsComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxSizedButtonsComponent {
}

View file

@ -1,14 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
@Component({
selector: 'ngx-grid',
styleUrls: ['./grid.component.scss'],
templateUrl: './grid.component.html',
})
export class NgxGridComponent implements OnInit {
constructor() { }
ngOnInit() { }
export class NgxGridComponent {
}

View file

@ -1,11 +1,11 @@
import { Component, OnInit, Pipe, PipeTransform } from '@angular/core';
import { Component, Pipe, PipeTransform } from '@angular/core';
@Component({
selector: 'ngx-icons',
styleUrls: ['./icons.component.scss'],
templateUrl: './icons.component.html',
})
export class NgxIconsComponent implements OnInit {
export class NgxIconsComponent {
icons = {
@ -33,10 +33,6 @@ export class NgxIconsComponent implements OnInit {
'fa fa-birthday-cake', 'fa fa-bolt', 'fa fa-bomb', 'fa fa-book', 'fa fa-bookmark', 'fa fa-bookmark-o',
'fa fa-briefcase', 'fa fa-bug', 'fa fa-building', 'fa fa-building-o', 'fa fa-bullhorn',
],
}
constructor() { }
ngOnInit() { }
};
}

View file

@ -1,11 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'ngx-modal',
templateUrl: './modal.component.html'
templateUrl: './modal.component.html',
})
export class NgxModalComponent implements OnInit {
export class NgxModalComponent {
modalHeader: string;
modalContent: string = `Lorem ipsum dolor sit amet,
@ -17,8 +17,6 @@ export class NgxModalComponent implements OnInit {
constructor(private activeModal: NgbActiveModal) { }
ngOnInit() { }
closeModal() {
this.activeModal.close();
}

View file

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { NgxModalComponent } from './modal/modal.component';
@ -8,12 +8,10 @@ import { NgxModalComponent } from './modal/modal.component';
styleUrls: ['./modals.component.scss'],
templateUrl: './modals.component.html',
})
export class NgxModalsComponent implements OnInit {
export class NgxModalsComponent {
constructor(private modalService: NgbModal) { }
ngOnInit() { }
showLargeModal() {
const activeModal = this.modalService.open(NgxModalComponent, { size: 'lg' });
@ -28,7 +26,7 @@ export class NgxModalsComponent implements OnInit {
showStaticModal() {
const activeModal = this.modalService.open(NgxModalComponent, {
size: 'sm',
backdrop: 'static'
backdrop: 'static',
});
activeModal.componentInstance.modalHeader = 'Static modal';