docs: refactor style guide example 01-01 (#22738)
docs: refactor style guide example 01-01 PR Close #22738
This commit is contained in:
parent
6b859daea4
commit
4d6f467fea
|
@ -1,9 +1,8 @@
|
|||
// #docregion
|
||||
/* avoid */
|
||||
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { Component, NgModule, OnInit } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { NgModule, Component, OnInit } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
class Hero {
|
||||
id: number;
|
||||
|
@ -24,7 +23,7 @@ class AppComponent implements OnInit {
|
|||
heroes: Hero[] = [];
|
||||
|
||||
ngOnInit() {
|
||||
getHeroes().then(heroes => this.heroes = heroes);
|
||||
getHeroes().then(heroes => (this.heroes = heroes));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +40,7 @@ platformBrowserDynamic().bootstrapModule(AppModule);
|
|||
const HEROES: Hero[] = [
|
||||
{ id: 1, name: 'Bombasto' },
|
||||
{ id: 2, name: 'Tornado' },
|
||||
{id: 3, name: 'Magneta'},
|
||||
{ id: 3, name: 'Magneta' }
|
||||
];
|
||||
|
||||
function getHeroes(): Promise<Hero[]> {
|
||||
|
|
|
@ -4,5 +4,5 @@ import { Hero } from './hero.model';
|
|||
export const HEROES: Hero[] = [
|
||||
{ id: 1, name: 'Bombasto' },
|
||||
{ id: 2, name: 'Tornado' },
|
||||
{id: 3, name: 'Magneta'},
|
||||
{ id: 3, name: 'Magneta' }
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue