Информация об изменениях

Сообщение Re[2]: JavaScript (точнее front-end) в 2018 году... от 31.10.2018 17:46

Изменено 31.10.2018 17:47 Shmj

Re[2]: JavaScript (точнее front-end) в 2018 году...
Здравствуйте, andini, Вы писали:

A>Минвайл правильный Ангуляр, который "не лапша JS и HTML". Ну-ну. Ты веб-программирование в руки взял за пять минут до написания своего тролль-поста?


A>
A>import { Component, Input } from '@angular/core';
 
A>import { Hero } from './hero';
 
A>@Component({
A>  selector: 'app-hero-child',
A>  template: `
A>    <h3>{{hero.name}} says:</h3>
A>    <p>I, {{hero.name}}, am at your service, {{masterName}}.</p>
A>  `
A>})
A>export class HeroChildComponent {
A>  @Input() hero: Hero;
A>  @Input('master') masterName: string;
A>}

A>


A>
A>import { Component } from '@angular/core';
 
A>import { HEROES } from './hero';
 
A>@Component({
A>  selector: 'app-hero-parent',
A>  template: `
A>    <h2>{{master}} controls {{heroes.length}} heroes</h2>
A>    <app-hero-child *ngFor="let hero of heroes"
A>      [hero]="hero"
A>      [master]="master">
A>    </app-hero-child>
A>  `
A>})
A>export class HeroParentComponent {
A>  heroes = HEROES;
A>  master = 'Master';
A>}
A>


A>
A>@Component({
A>  selector: 'app-version-parent',
A>  template: `
A>    <h2>Source code version</h2>
A>    <button (click)="newMinor()">New minor version</button>
A>    <button (click)="newMajor()">New major version</button>
A>    <app-version-child [major]="major" [minor]="minor"></app-version-child>
A>  `
A>})
A>export class VersionParentComponent {
A>  major = 1;
A>  minor = 23;
 
A>  newMinor() {
A>    this.minor++;
A>  }
 
A>  newMajor() {
A>    this.major++;
A>    this.minor = 0;
A>  }
A>}
A>


Одно дело указать шаблон. Совсем другое дело смешивать JS и куски HTML (как то в цикле прописать кусок HTML-я).
Re[2]: JavaScript (точнее front-end) в 2018 году...
Здравствуйте, andini, Вы писали:

A>Минвайл правильный Ангуляр, который "не лапша JS и HTML". Ну-ну. Ты веб-программирование в руки взял за пять минут до написания своего тролль-поста?


A>
A>import { Component, Input } from '@angular/core';
 
A>import { Hero } from './hero';
 
A>@Component({
A>  selector: 'app-hero-child',
A>  template: `
A>    <h3>{{hero.name}} says:</h3>
A>    <p>I, {{hero.name}}, am at your service, {{masterName}}.</p>
A>  `
A>})
A>export class HeroChildComponent {
A>  @Input() hero: Hero;
A>  @Input('master') masterName: string;
A>}

A>


A>
A>import { Component } from '@angular/core';
 
A>import { HEROES } from './hero';
 
A>@Component({
A>  selector: 'app-hero-parent',
A>  template: `
A>    <h2>{{master}} controls {{heroes.length}} heroes</h2>
A>    <app-hero-child *ngFor="let hero of heroes"
A>      [hero]="hero"
A>      [master]="master">
A>    </app-hero-child>
A>  `
A>})
A>export class HeroParentComponent {
A>  heroes = HEROES;
A>  master = 'Master';
A>}
A>


A>
A>@Component({
A>  selector: 'app-version-parent',
A>  template: `
A>    <h2>Source code version</h2>
A>    <button (click)="newMinor()">New minor version</button>
A>    <button (click)="newMajor()">New major version</button>
A>    <app-version-child [major]="major" [minor]="minor"></app-version-child>
A>  `
A>})
A>export class VersionParentComponent {
A>  major = 1;
A>  minor = 23;
 
A>  newMinor() {
A>    this.minor++;
A>  }
 
A>  newMajor() {
A>    this.major++;
A>    this.minor = 0;
A>  }
A>}
A>


Одно дело указать шаблон. Совсем другое дело смешивать JS и куски HTML (как то в цикле прописать кусок HTML-я).

А вообще Angular позволяет писать html-шаблоны в отдельном файле. А в React — все в куче.