docs: clean up docregions in the `getting-started` docs example (#40197)

This commit does some minor clean-up in docregions of the
`getting-started` docs example. More specifically, it:
- Removes redundant docregion markers.
- Fixes whitespace inconsistencies.
- Adds `/* ... */` to indicate that there is more code before the end of
  a docregion (in order to avoid confusion).

PR Close #40197
This commit is contained in:
George Kalpakas 2021-01-06 23:05:45 +02:00 committed by atscott
parent 1fae285e04
commit 1d78d4d774
3 changed files with 13 additions and 12 deletions

View File

@ -11,7 +11,7 @@ import { products } from '../products';
templateUrl: './product-details.component.html', templateUrl: './product-details.component.html',
styleUrls: ['./product-details.component.css'] styleUrls: ['./product-details.component.css']
}) })
// #docregion props-methods, add-to-cart, product-prop // #docregion props-methods, product-prop
export class ProductDetailsComponent implements OnInit { export class ProductDetailsComponent implements OnInit {
product; product;
// #enddocregion product-prop // #enddocregion product-prop
@ -29,9 +29,9 @@ export class ProductDetailsComponent implements OnInit {
this.product = products.find(product => { this.product = products.find(product => {
return product.id === Number(productIdFromRoute); return product.id === Number(productIdFromRoute);
}); });
// #docregion product-prop
} }
// #enddocregion product-prop
// #enddocregion get-product // #enddocregion get-product
// #docregion product-prop
/* ... */
// #docregion props-methods // #docregion props-methods
} }

View File

@ -13,9 +13,9 @@ import { CartService } from '../cart.service';
templateUrl: './product-details.component.html', templateUrl: './product-details.component.html',
styleUrls: ['./product-details.component.css'] styleUrls: ['./product-details.component.css']
}) })
// #docregion props-methods, get-product, inject-cart-service, add-to-cart // #docregion props-methods, inject-cart-service, add-to-cart
export class ProductDetailsComponent implements OnInit { export class ProductDetailsComponent implements OnInit {
// #enddocregion add-to-cart, get-product, inject-cart-service // #enddocregion add-to-cart, inject-cart-service
product; product;
// #docregion inject-cart-service // #docregion inject-cart-service
@ -27,7 +27,6 @@ export class ProductDetailsComponent implements OnInit {
) { } ) { }
// #enddocregion inject-cart-service // #enddocregion inject-cart-service
// #docregion get-product
ngOnInit() { ngOnInit() {
// #enddocregion props-methods // #enddocregion props-methods
// First get the product id from the current route. // First get the product id from the current route.
@ -39,11 +38,11 @@ export class ProductDetailsComponent implements OnInit {
// #docregion props-methods // #docregion props-methods
} }
// #enddocregion props-methods, get-product // #enddocregion props-methods
// #docregion add-to-cart // #docregion add-to-cart
addToCart(product) { addToCart(product) {
this.cartService.addToCart(product); this.cartService.addToCart(product);
window.alert('Your product has been added to the cart!'); window.alert('Your product has been added to the cart!');
} }
// #docregion props-methods, get-product, inject-cart-service // #docregion props-methods, inject-cart-service
} }

View File

@ -8,7 +8,8 @@
{{ product.name }} {{ product.name }}
</a> </a>
</h3> </h3>
<!-- #enddocregion router-link -->
<!-- #enddocregion router-link -->
<p *ngIf="product.description"> <p *ngIf="product.description">
Description: {{ product.description }} Description: {{ product.description }}
</p> </p>
@ -21,6 +22,7 @@
[product]="product" [product]="product"
(notify)="onNotify()"> (notify)="onNotify()">
</app-product-alerts> </app-product-alerts>
<!-- #docregion router-link --> <!-- #docregion router-link -->
</div> </div>
<!-- #enddocregion router-link --> <!-- #enddocregion router-link -->