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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,11 +1,11 @@
import { Component, OnInit, Pipe, PipeTransform } from '@angular/core'; import { Component, Pipe, PipeTransform } from '@angular/core';
@Component({ @Component({
selector: 'ngx-icons', selector: 'ngx-icons',
styleUrls: ['./icons.component.scss'], styleUrls: ['./icons.component.scss'],
templateUrl: './icons.component.html', templateUrl: './icons.component.html',
}) })
export class NgxIconsComponent implements OnInit { export class NgxIconsComponent {
icons = { 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-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', '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'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@Component({ @Component({
selector: 'ngx-modal', selector: 'ngx-modal',
templateUrl: './modal.component.html' templateUrl: './modal.component.html',
}) })
export class NgxModalComponent implements OnInit { export class NgxModalComponent {
modalHeader: string; modalHeader: string;
modalContent: string = `Lorem ipsum dolor sit amet, modalContent: string = `Lorem ipsum dolor sit amet,
@ -17,8 +17,6 @@ export class NgxModalComponent implements OnInit {
constructor(private activeModal: NgbActiveModal) { } constructor(private activeModal: NgbActiveModal) { }
ngOnInit() { }
closeModal() { closeModal() {
this.activeModal.close(); 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 { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { NgxModalComponent } from './modal/modal.component'; import { NgxModalComponent } from './modal/modal.component';
@ -8,12 +8,10 @@ import { NgxModalComponent } from './modal/modal.component';
styleUrls: ['./modals.component.scss'], styleUrls: ['./modals.component.scss'],
templateUrl: './modals.component.html', templateUrl: './modals.component.html',
}) })
export class NgxModalsComponent implements OnInit { export class NgxModalsComponent {
constructor(private modalService: NgbModal) { } constructor(private modalService: NgbModal) { }
ngOnInit() { }
showLargeModal() { showLargeModal() {
const activeModal = this.modalService.open(NgxModalComponent, { size: 'lg' }); const activeModal = this.modalService.open(NgxModalComponent, { size: 'lg' });
@ -28,7 +26,7 @@ export class NgxModalsComponent implements OnInit {
showStaticModal() { showStaticModal() {
const activeModal = this.modalService.open(NgxModalComponent, { const activeModal = this.modalService.open(NgxModalComponent, {
size: 'sm', size: 'sm',
backdrop: 'static' backdrop: 'static',
}); });
activeModal.componentInstance.modalHeader = 'Static modal'; activeModal.componentInstance.modalHeader = 'Static modal';