Skip to content

Commit b09a716

Browse files
JeanMechealxhub
authored andcommitted
docs: remove empty constructors & ngOnInit() (#48576)
PR Close #48576
1 parent b3d0a27 commit b09a716

File tree

5 files changed

+3
-18
lines changed

5 files changed

+3
-18
lines changed

aio/content/examples/property-binding/src/app/item-detail/item-detail.component.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Component, OnInit, Input } from '@angular/core';
77
templateUrl: './item-detail.component.html',
88
styleUrls: ['./item-detail.component.css']
99
})
10-
export class ItemDetailComponent implements OnInit {
10+
export class ItemDetailComponent {
1111

1212
// #docregion input-type
1313
@Input() childItem = '';
@@ -18,9 +18,4 @@ export class ItemDetailComponent implements OnInit {
1818

1919
currentItem = 'bananas in boxes';
2020

21-
constructor() { }
22-
23-
ngOnInit() {
24-
}
25-
2621
}

aio/content/examples/property-binding/src/app/item-list/item-list.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ export class ItemListComponent {
1212
// #docregion item-input
1313
@Input() items: Item[] = [];
1414
// #enddocregion item-input
15-
constructor() { }
1615

1716
}

aio/content/examples/two-way-binding/src/app/app.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Component } from '@angular/core';
66
styleUrls: ['./app.component.css']
77
})
88
export class AppComponent {
9-
constructor() { }
109
// #docregion font-size
1110
fontSizePx = 16;
1211
// #enddocregion font-size
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component } from '@angular/core';
22

33
@Component({
44
selector: 'app-home',
55
templateUrl: './home.component.html',
66
styleUrls: ['./home.component.css']
77
})
8-
export class HomeComponent implements OnInit {
9-
10-
constructor() { }
11-
12-
ngOnInit() {
13-
}
8+
export class HomeComponent {
149

1510
}

aio/content/start/start-data.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ For customers to see their cart, you can create the cart view in two steps:
115115

116116
<code-example header="src/app/cart/cart.component.ts" path="getting-started/src/app/cart/cart.component.1.ts"></code-example>
117117

118-
StackBlitz also generates an `ngOnInit()` by default in components.
119-
You can ignore the `CartComponent` `ngOnInit()` for this tutorial.
120-
121118
1. Notice that the newly created `CartComponent` is added to the module's `declarations` in `app.module.ts`.
122119

123120
<code-example header="src/app/app.module.ts" path="getting-started/src/app/app.module.ts" region="declare-cart"></code-example>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy