docs: refactor style guide example 01-01 (#22738)

docs: refactor style guide example 01-01


PR Close #22738
This commit is contained in:
Daniel 2018-07-11 18:27:54 +02:00 committed by Victor Berchet
parent 6b859daea4
commit 4d6f467fea
4 changed files with 17 additions and 18 deletions

View File

@ -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[]> {

View File

@ -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' }
];