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

View File

@ -13,9 +13,9 @@ import { CartService } from '../cart.service';
templateUrl: './product-details.component.html',
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 {
// #enddocregion add-to-cart, get-product, inject-cart-service
// #enddocregion add-to-cart, inject-cart-service
product;
// #docregion inject-cart-service
@ -27,7 +27,6 @@ export class ProductDetailsComponent implements OnInit {
) { }
// #enddocregion inject-cart-service
// #docregion get-product
ngOnInit() {
// #enddocregion props-methods
// First get the product id from the current route.
@ -39,11 +38,11 @@ export class ProductDetailsComponent implements OnInit {
// #docregion props-methods
}
// #enddocregion props-methods, get-product
// #enddocregion props-methods
// #docregion add-to-cart
addToCart(product) {
this.cartService.addToCart(product);
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,19 +8,21 @@
{{ product.name }}
</a>
</h3>
<!-- #enddocregion router-link -->
<!-- #enddocregion router-link -->
<p *ngIf="product.description">
Description: {{ product.description }}
</p>
<button (click)="share()">
Share
</button>
<app-product-alerts
[product]="product"
(notify)="onNotify()">
</app-product-alerts>
<!-- #docregion router-link -->
<!-- #docregion router-link -->
</div>
<!-- #enddocregion router-link -->